Kernel/heap - Check for free(NULL) and silently ignore
authorJohn Hodge <[email protected]>
Sat, 10 May 2014 07:40:07 +0000 (15:40 +0800)
committerJohn Hodge <[email protected]>
Sat, 10 May 2014 07:40:07 +0000 (15:40 +0800)
KernelLand/Kernel/heap.c

index f7054ea..ba4c9ad 100755 (executable)
@@ -353,6 +353,8 @@ void Heap_Deallocate(const char *File, int Line, void *Ptr)
        // INVLPTR is returned from Heap_Allocate when the allocation
        // size is zero.
        if( Ptr == INVLPTR )    return;
+       // free(NULL) is a no-op
+       if( Ptr == NULL )       return;
        
        // Alignment Check
        if( (tVAddr)Ptr % sizeof(void*) != 0 ) {

UCC git Repository :: git.ucc.asn.au