This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] xtensa-tdep.c ARI fixes


Thanks for noticing this. xfree () is necessary here.

-- Maxim

On 04/14/2011 01:31 PM, Tom Tromey wrote:
"Pierre" == Pierre Muller<pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre>    The only non-trivial change is in xtensa_register_type:
Pierre>  this is mainly because I do not understand the old code:
Pierre>  it was using both xmalloc and strdup, which should
Pierre>  create a memory leak, no?
Pierre>    But maybe I miss something?

I agree.

Pierre>  -		  char *name = xmalloc (16);
Pierre>  +		  char *name = xstrprintf ("int%d", size * 8);

Looks better.

Pierre> + = arch_integer_type (gdbarch, size * 8, 1, name);

arch_integer_type calls arch_type, which calls xstrdup(name).
So I think you need to xfree name here.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]