leak-detective: remove hdr entry when reallocating zero bytes
This commit is contained in:
@@ -872,6 +872,12 @@ HOOK(void*, realloc, void *old, size_t bytes)
|
|||||||
{
|
{
|
||||||
return malloc(bytes);
|
return malloc(bytes);
|
||||||
}
|
}
|
||||||
|
/* handle zero size as a free() */
|
||||||
|
if (bytes == 0)
|
||||||
|
{
|
||||||
|
free(old);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
hdr = old - sizeof(memory_header_t);
|
hdr = old - sizeof(memory_header_t);
|
||||||
tail = old + hdr->bytes;
|
tail = old + hdr->bytes;
|
||||||
|
|||||||
Reference in New Issue
Block a user