From: Ben Pfaff Date: Sun, 5 Sep 2004 08:14:23 +0000 (+0000) Subject: free() on a null pointer is a no-op. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33b8d7835fa9480a16f1032a61a851f73be83e11;p=pintos-anon free() on a null pointer is a no-op. --- diff --git a/src/threads/malloc.c b/src/threads/malloc.c index 02eee99..7af1156 100644 --- a/src/threads/malloc.c +++ b/src/threads/malloc.c @@ -164,6 +164,9 @@ free (void *p) struct arena *a = block_to_arena (b); struct desc *d = a->desc; + if (p == NULL) + return; + lock_acquire (&d->lock); /* Add block to free list. */