Re: [RFA] Fix leaks in macro definitions.

Philippe Waroquiers
2019-01-15T19:55:16Z

On Tue, 2019-01-15 at 11:50 -0500, Simon Marchi wrote:
> > + gdb::unique_xmalloc_ptr<char> name (extract_identifier (&exp, 0));
> > + if (name.get () == NULL)
>
> Nit, you don't have to use ".get ()" here.
One day, I will really have to learn some C++ :).

>
> I think extract_identifier should return a gdb::unique_xmalloc_ptr.
> This call site lower:
>
> argv[new_macro.argc] = extract_identifier (&exp, 1);
>
> can then use ".release ()".
Yes, that looks like a cleaner approach.

I will update the patch once the question about how to
handle the splay tree leak is clarified
i.e. fix in GDB, or (incompatible) fix in libiberty.
(see other mail with Tom).

Thanks

Philippe