From 310726211442cfdf79212010c64d9ba1f86d6c06 Mon Sep 17 00:00:00 2001 From: Reinier Maas Date: Wed, 10 Oct 2018 13:15:06 +0200 Subject: [PATCH] Update memalloc.c Calling malloc from realloc with a size of 0 will return NULL. Remove call to malloc in realloc. --- memalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memalloc.c b/memalloc.c index e4354cf..2242f90 100644 --- a/memalloc.c +++ b/memalloc.c @@ -133,7 +133,7 @@ void *realloc(void *block, size_t size) struct header_t *header; void *ret; if (!block || !size) - return malloc(size); + return NULL; header = (struct header_t*)block - 1; if (header->size >= size) return block;