Re: [PATCH 08/19] perf tools: Add mem2node object

From: Arnaldo Carvalho de Melo
Date: Thu Mar 08 2018 - 08:00:38 EST


Em Thu, Mar 08, 2018 at 09:58:49AM -0300, Arnaldo Carvalho de Melo escreveu:
> We end up leaking entries when what I'm suggesting you to do is to
> not clobber entries with the return of realloc() (doing it this way most
> of the time leads to bugs), but instead store it to a temp var
> (nentries), and if it succeeds, then you know that you can
> set nentries to entries and go ahead with your nicely shrunk block of
> memory.

> If it fails, then you continue with the original block of memory, that
> continues to have what you just set up, etc.

> Lemme look a third time to your original patch, I must be missing
> something...

I don't think I'm missing anything ;-)

- Arnaldo