This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] xtensa-tdep.c ARI fixes
- From: Tom Tromey <tromey at redhat dot com>
- To: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: <gdb-patches at sourceware dot org>, "'Maxim Grigoriev'" <maxim at tensilica dot com>
- Date: Thu, 14 Apr 2011 14:31:41 -0600
- Subject: Re: [RFA] xtensa-tdep.c ARI fixes
- References: <15837.6740910628$1302342165@news.gmane.org>
>>>>> "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