From 15ee623d18ed68984e486c4d578c7cce5377aebd Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 10 May 2014 15:40:07 +0800 Subject: [PATCH 1/1] Kernel/heap - Check for free(NULL) and silently ignore --- KernelLand/Kernel/heap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/KernelLand/Kernel/heap.c b/KernelLand/Kernel/heap.c index f7054ea4..ba4c9adb 100755 --- a/KernelLand/Kernel/heap.c +++ b/KernelLand/Kernel/heap.c @@ -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 ) { -- 2.20.1