[vlc-devel] commit: Do not malloc(0) - to make valgrind not report 0 byte leaks ( Rafaël Carré )

Remi Denis-Courmont rdenis at simphalempin.com
Mon May 26 14:46:11 CEST 2008


On Mon, 26 May 2008 10:59:25 +0200, "Rafaël Carré" <funman at videolan.org>
wrote:
> "0 bytes in 1 blocks are definitely lost in loss record 1 of 29"
> at 0xblablabla vg_replace_malloc()
> by 0xblablabla PMT_CallBack (ts.c:3247)
> 
> It's a leak in the sense that the valid pointer is not freed, but I
> wonder if it has any side effects,

It was a real leak then. The heap allocator will leak the room to store its
metadata. It _might_ return a "dummy" NULL (or non-NULL) pointer to a zero
byte allocation... but it might also allocate a "normal" block of zero
bytes (+ meta data, which is probably at least a few bytes).

> I suppose libc keeps a reference to this pointer, so after X allocations,
> there will be a leak of X * sizeof(void*) bytes, not in VLC but in libc.

Well, then any VLC leak would be a libc leak. It makes no sense.

-- 
Rémi Denis-Courmont
http://www.remlab.net




More information about the vlc-devel mailing list