RFA: Correct field names for class methods
Daniel Jacobowitz
drow@mvista.com
Wed Aug 28 11:36:00 GMT 2002
On Wed, Aug 28, 2002 at 10:23:06AM -0700, David Carlton wrote:
> 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.
No can do. Look at where TYPE_NAME is allocated; sometimes (often?
Not sure.) it is on the obstack. We're not consistent about that. We
need to be, someday, but that's a separate cleanup.
> (Also, the ChangeLog entry has the name of this function written
> incorrectly.)
Oops, thanks!
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
More information about the Gdb-patches
mailing list