This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: Correct field names for class methods
- From: David Carlton <carlton at math dot stanford dot edu>
- To: Daniel Jacobowitz <drow at mvista dot com>
- Cc: gdb-patches at sources dot redhat dot com, ezannoni at redhat dot com
- Date: 28 Aug 2002 10:23:06 -0700
- Subject: Re: RFA: Correct field names for class methods
- References: <20020827031346.GA16591@nevyn.them.org>
In article <20020827031346.GA16591@nevyn.them.org>, Daniel Jacobowitz
<drow@mvista.com> writes:
> +void
> +update_method_name_from_physname (char **old_name, char *physname)
> +{
> + char *method_name;
> +
> + method_name = method_name_from_physname (physname);
> +
> + if (method_name == NULL)
> + error ("bad physname %s\n", physname);
> +
> + if (strcmp (*old_name, method_name) != 0)
> + *old_name = method_name;
> + else
> + xfree (method_name);
> +}
I'm pretty sure this is a memory leak. How about replacing the last
if clause by
xfree(*old_name);
*old_name = method_name;
That should get rid of the memory leak and avoid a superfluous
strcmp.
(Also, the ChangeLog entry has the name of this function written
incorrectly.)
David Carlton
carlton@math.stanford.edu