From: John Hodge Date: Sat, 19 Jun 2010 02:57:04 +0000 (+0800) Subject: Fixed some edge cases in heap where the spinlock was not releases X-Git-Tag: rel0.06~141 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=1842ea1f2aa3a8d712087e616eb511cfc7174471;p=tpg%2Facess2.git Fixed some edge cases in heap where the spinlock was not releases --- 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; } }