kfree now gracefully accepts null pointers
authorKevin Klues <klueska@ros-dev.(none)>
Wed, 24 Mar 2010 07:33:32 +0000 (00:33 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:37 +0000 (17:35 -0700)
kern/src/kmalloc.c

index 101986d..65bc6b0 100644 (file)
@@ -136,7 +136,8 @@ void *krealloc(void* buf, size_t size, int flags) {
 
 void kfree(void *addr)
 {
-       assert(addr);
+       if(addr == NULL)
+               return;
        struct kmalloc_tag *tag = (struct kmalloc_tag*)(addr - KMALLOC_OFFSET);
        assert(tag->canary == KMALLOC_CANARY);
        if (tag->flags & KMALLOC_TAG_CACHE)