[RFA] Fix leak of set/show verbose doc, avoid xfree of static string

Tom Tromey tom@tromey.com
Fri Dec 28 16:45:00 GMT 2018


>>>>> "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.

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.

Tom



More information about the Gdb-patches mailing list