From 1842ea1f2aa3a8d712087e616eb511cfc7174471 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 19 Jun 2010 10:57:04 +0800 Subject: [PATCH] Fixed some edge cases in heap where the spinlock was not releases --- Kernel/heap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Kernel/heap.c b/Kernel/heap.c index a612d8a2..8d1db7d3 100644 --- a/Kernel/heap.c +++ b/Kernel/heap.c @@ -177,6 +177,7 @@ void *malloc(size_t Bytes) #if DEBUG_TRACE Log("[Heap ] Malloc'd %p (%i bytes), returning to %p", head->Data, head->Size, __builtin_return_address(0)); #endif + RELEASE(&glHeap); return head->Data; } @@ -205,10 +206,11 @@ void *malloc(size_t Bytes) } // Check size if(best->Size == Bytes) { - RELEASE(&glHeap); // Release spinlock + best->Magic = MAGIC_USED; // Mark block as used #if DEBUG_TRACE Log("[Heap ] Malloc'd %p (%i bytes), returning to %p", best->Data, best->Size, __builtin_return_address(0)); #endif + RELEASE(&glHeap); // Release spinlock return best->Data; } } -- 2.20.1