diff options
Diffstat (limited to 'src/compat.c')
-rw-r--r-- | src/compat.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/compat.c b/src/compat.c index 013675f..fa171f1 100644 --- a/src/compat.c +++ b/src/compat.c @@ -288,11 +288,21 @@ void vwarnx(const char *fmt, va_list ap) void* reallocf(void* ptr, size_t size) { void* ret = realloc(ptr, size); + if(!ret) + errx(1, "out of memory"); + return ret; +} + +#endif - if(!ret && size) - free(ptr); +#ifndef HAVE_MALLOCF - return ret; +void* mallocf(size_t size) +{ + void* ret = malloc(size); + if(!ret) + errx(1, "out of memory"); + return ret; } #endif |