From 5643fdce0f680fe8a6172e2605726fc974cd472b Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Mon, 21 Oct 2013 21:48:23 +0400 Subject: calloc: Fix possible memory leak Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- common/dlmalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 7ad368ee53..b4341fef54 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -1750,11 +1750,11 @@ void *calloc(size_t n, size_t elem_size) mchunkptr oldtop = top; INTERNAL_SIZE_T oldtopsize = chunksize(top); - void *mem = malloc(sz); - if ((long)n < 0) return NULL; + void *mem = malloc(sz); + if (!mem) return NULL; else { -- cgit v1.2.3