9
0
Fork 0

calloc: Fix possible memory leak

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Alexander Shiyan 2013-10-21 21:48:23 +04:00 committed by Sascha Hauer
parent 6b8b04c0ab
commit 5643fdce0f
1 changed files with 2 additions and 2 deletions

View File

@ -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 {