[PATCH v2] malloc: fix memleak in function muntrace

Zack Weinberg zackw@panix.com
Mon Apr 20 16:15:57 GMT 2020


On Mon, Apr 20, 2020 at 10:50 AM Florian Weimer <fw@deneb.enyo.de> wrote:
> * chenzefeng:
> > +  if (malloc_trace_buffer != NULL)
> > +    free (malloc_trace_buffer);
> >  }
>
> I think you can call free unconditionally.

I was going to say the same thing.  (free(NULL) is specified to do nothing.)

Also, it would be good to set malloc_trace_buffer to NULL after calling free.

Also, __release_libc_mem should be calling muntrace (after calling
__libc_freeres).

zw


More information about the Libc-alpha mailing list