leak-detective: remove hdr entry when reallocating zero bytes
This commit is contained in:
1 parent
c93cf85356
commit
1e54e40f5d
1 file changed
+6
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user