leak-detective: remove hdr entry when reallocating zero bytes

This commit is contained in:
Martin Willi
2013-07-12 20:00:16 +02:00
parent c93cf85356
commit 1e54e40f5d
+6
View File
@@ -872,6 +872,12 @@ HOOK(void*, realloc, void *old, size_t bytes)
{
return malloc(bytes);
}
/* handle zero size as a free() */
if (bytes == 0)
{
free(old);
return NULL;
}
hdr = old - sizeof(memory_header_t);
tail = old + hdr->bytes;