[RFA] Avoid memory leaks in set_language function.

Tom Tromey tromey@redhat.com
Wed Dec 5 18:19:00 GMT 2012


>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:

Pierre> This also revealed a few memory leaks
Pierre> related to repeated add_language function calls.

Wow, add_language is gross.  I had no idea.

Pierre> +         if (iter->doc && iter->flags & DOC_ALLOCATED)

I think parens around the second clause here.
Actually I tend to prefer the wordier

    (iter->flags & DOC_ALLOCATED) != 0

Pierre>  #define MALLOCED_REPLACEMENT      0x4
Pierre> -
Pierre> +#define DOC_ALLOCATED             0x8
Pierre>  struct cmd_list_element

Please preserve the blank line after the block of #defines.

Ok with those changes.

Tom



More information about the Gdb-patches mailing list