diff options
Diffstat (limited to 'wrapper.c')
-rw-r--r-- | wrapper.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -117,10 +117,13 @@ void *xrealloc(void *ptr, size_t size) { void *ret; + if (!size) { + free(ptr); + return xmalloc(0); + } + memory_limit_check(size, 0); ret = realloc(ptr, size); - if (!ret && !size) - ret = realloc(ptr, 1); if (!ret) die("Out of memory, realloc failed"); return ret; |