Re: libiberty/cplus-dem.c, ada-demangle: plug memory leak.

Jakub Jelinek
2011-03-03T21:30:24Z

On Thu, Mar 03, 2011 at 01:20:28PM -0800, Michael Snyder wrote:
> 2011-03-03 Michael Snyder <msnyder@vmware.com>
>
> * libiberty/cplus-dem.c (ada_demangle): Stop memory leak.
> Also fix a one line indent problem.

No libiberty/ in libiberty/ChangeLog.

> @@ -1129,10 +1129,11 @@ ada_demangle (const char *mangled, int o
>
> unknown:
> len0 = strlen (mangled);
> + xfree (demangled);
> demangled = XNEWVEC (char, len0 + 3);

xfree isn't ever used in libiberty/*, use either free, or
XDELETE/XDELETEVEC. In fact, it seems to be defined only in gdb,
making cplus-dem.c dependent on gdb is obviously a wrong thing.

Jakub