another re_alloc() bit

realloc(NULL, size) is legitimate usage and nhrealloc() shouldn't
log a "<  0x00000000 __FILE__ __LINE__" entry for it.  heaputil
would complain about freeing Null.
This commit is contained in:
PatR
2022-05-31 10:36:12 -07:00
parent af497bfb25
commit 42981361d7
+4 -3
View File
@@ -164,9 +164,10 @@ nhrealloc(
* allocation rather than make a new one */ * allocation rather than make a new one */
if (newptr != oldptr) { if (newptr != oldptr) {
/* realloc() freed oldptr */ /* if oldptr wasn't Null, realloc() freed it */
(void) fprintf(heaplog, "%c%5s %s %4d %s\n", '<', "", if (oldptr)
fmt_ptr((genericptr_t) oldptr), line, file); (void) fprintf(heaplog, "%c%5s %s %4d %s\n", '<', "",
fmt_ptr((genericptr_t) oldptr), line, file);
op = '>'; /* new allocation rather than size-change of old one */ op = '>'; /* new allocation rather than size-change of old one */
} }
(void) fprintf(heaplog, "%c%5u %s %4d %s\n", op, newlth, (void) fprintf(heaplog, "%c%5u %s %4d %s\n", op, newlth,