From 8279a37642b385129e1ceb4f6abf8f9c66f69742 Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 9 Aug 1989 16:25:50 +0000 Subject: [PATCH] made more ANSI conformant --- modules/src/malloc/mal.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/src/malloc/mal.c b/modules/src/malloc/mal.c index 29ad660f5..253c7e581 100644 --- a/modules/src/malloc/mal.c +++ b/modules/src/malloc/mal.c @@ -39,6 +39,9 @@ malloc(n) register mallink *ml; register int min_class; + if (n == 0) { + return 0; + } if (n < MIN_SIZE) n = align(MIN_SIZE); else n = align(n); #ifdef STORE if (n <= MAX_STORE*MIN_SIZE) { @@ -234,6 +237,10 @@ realloc(addr, n) */ return malloc(n); } + if (n == 0) { + free(addr); + return 0; + } ml = mallink_of_block(addr); if (n < MIN_SIZE) n = align(MIN_SIZE); else n = align(n); #ifdef STORE