* lib/memory.c: (zrealloc) If is called with NULL pointer then it should
increment allocations because it behaves the same as zmalloc.
(zfree) is called with NULL pointer, it does nothing therefore allocation
count should not change.
memory = realloc (ptr, size);
if (memory == NULL)
zerror ("realloc", type, size);
+ if (ptr == NULL)
+ alloc_inc (type);
+
return memory;
}
void
zfree (int type, void *ptr)
{
- alloc_dec (type);
- free (ptr);
+ if (ptr != NULL)
+ {
+ alloc_dec (type);
+ free (ptr);
+ }
}
/*