This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Fix leak of set/show verbose doc, avoid xfree of static string
On Fri, 2018-12-28 at 09:45 -0700, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
>
> Philippe> gdb/ChangeLog
> Philippe> 2018-12-28 Philippe Waroquiers <philippe.waroquiers@skynet.be>
>
> Philippe> * top.c (set_verbose): Free previous docs if doc_allocated.
> Philippe> Internationalize messages. Set doc_allocated to 0.
>
> Thanks for the patch. This is ok.
Thanks for the review, pushed.
>
> Philippe> + if (c->doc && c->doc_allocated)
> Philippe> + xfree ((char *) c->doc);
> Philippe> + if (showcmd->doc && showcmd->doc_allocated)
> Philippe> + xfree ((char *) showcmd->doc);
>
> Ideally I guess we'd have a better way of doing this. A lot of the CLI
> machinery could use some cleanup, but for now this is still an "open"
> struct.
Effectively, as it is now, cmd_list_element memory management
is not very well encapsulated.
Philippe