From a1cdd1d02495657a47d442d0235a10987f9dc752 Mon Sep 17 00:00:00 2001 From: QiaoChong Date: Sat, 25 May 2019 20:28:32 +0800 Subject: [PATCH] free allow null ptr. Change-Id: Id1221defb7400f49c1e1ba8b6fdf6fe142370fbe Signed-off-by: QiaoChong --- lib/libc/malloc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libc/malloc.c b/lib/libc/malloc.c index cd928e9c..df664409 100644 --- a/lib/libc/malloc.c +++ b/lib/libc/malloc.c @@ -112,6 +112,7 @@ void free(void *ap) { HEADER *p, *q; + if (!ap) return; p = (HEADER *) ap - 1; if (p->s.ptr != p)