From cccb0dd197ae20c94e45fa0622ebaf463504171b Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 31 Oct 1989 09:44:21 +0000 Subject: [PATCH] if malloc can return 0 on a 0 argument, free should also accept 0 --- modules/src/malloc/mal.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/src/malloc/mal.c b/modules/src/malloc/mal.c index 7043f19e8..5ff02b0fe 100644 --- a/modules/src/malloc/mal.c +++ b/modules/src/malloc/mal.c @@ -152,7 +152,13 @@ malloc(n) free(addr) char *addr; {check_mallinks("free entry");{ - register mallink *ml = mallink_of_block(addr); + register mallink *ml; + + if (addr == 0) { + check_mallinks("free(0) very fast exit"); + return; + } + ml = mallink_of_block(addr); #ifdef STORE