From 2b3a33160271056e2148ea59f7aa6f9ebabdeecd Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Wed, 29 Nov 2017 14:25:14 +0100 Subject: [PATCH] Changed the behaviour if trying to realloc a memory chunk of size 0 to be consistent across systems (an error would be generated on Ubuntu when no primers found) --- src/libecoPCR/ecoMalloc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libecoPCR/ecoMalloc.c b/src/libecoPCR/ecoMalloc.c index 5796d7e..c34f97c 100644 --- a/src/libecoPCR/ecoMalloc.c +++ b/src/libecoPCR/ecoMalloc.c @@ -54,8 +54,14 @@ void *eco_realloc(void *chunk, { void *newchunk; - newchunk = realloc(chunk,newsize); + if (newsize == 0) + { + if (chunk) + free(chunk); + return NULL; + } + newchunk = realloc(chunk,newsize); if (!newchunk) {