[vlc-devel] [PATCH] realloc: use realloc_or_free() to avoid memory leak

Rémi Denis-Courmont remi at remlab.net
Mon Dec 15 15:30:57 CET 2014

Le 2014-12-13 18:52, Arjun Sreedharan a écrit :
> On 10 December 2014 at 23:49, Ar
>>> I checked only one snippet and it was introducing a double free() 
>>> bug rather
>>> than fixing anything...
>> Could you please annotate that line. I was unable to spot
> Ping !! Any pointers on this if anyone has time (?)

You seem to assume that 'a = realloc(a, ...)' is a memory leak. But 
that is not always the case.

The original pointer value may be retained via another pointer object, 
in which case there is no leak. Alternatively the code can check for 
reallocation failure and abort, in which case there is no leak as well.

Rémi Denis-Courmont

More information about the vlc-devel mailing list