Browse Source

free allow null ptr.

Change-Id: Id1221defb7400f49c1e1ba8b6fdf6fe142370fbe
Signed-off-by: QiaoChong <qiaochong@loongson.cn>
master
QiaoChong 6 years ago
parent
commit
a1cdd1d024
  1. 1
      lib/libc/malloc.c

1
lib/libc/malloc.c

@ -112,6 +112,7 @@ void
free(void *ap) free(void *ap)
{ {
HEADER *p, *q; HEADER *p, *q;
if (!ap) return;
p = (HEADER *) ap - 1; p = (HEADER *) ap - 1;
if (p->s.ptr != p) if (p->s.ptr != p)

Loading…
Cancel
Save