Kernel - Fixed heap debug issue with valid side not being set
authorJohn Hodge <[email protected]>
Sun, 5 Jun 2011 16:20:33 +0000 (00:20 +0800)
committerJohn Hodge <[email protected]>
Sun, 5 Jun 2011 16:20:33 +0000 (00:20 +0800)
Kernel/heap.c

index ea32436..262053b 100644 (file)
@@ -211,6 +211,7 @@ void *Heap_Allocate(const char *File, int Line, size_t __Bytes)
                        head->Magic = MAGIC_USED;
                        head->File = File;
                        head->Line = Line;
+                       head->ValidSize = __Bytes;
                        Mutex_Release(&glHeap); // Release spinlock
                        #if DEBUG_TRACE
                        Log("[Heap   ] Malloc'd %p (%i bytes), returning to %p", head->Data, head->Size,  __builtin_return_address(0));
@@ -246,6 +247,7 @@ void *Heap_Allocate(const char *File, int Line, size_t __Bytes)
                        best->Magic = MAGIC_USED;       // Mark block as used
                        best->File = File;
                        best->Line = Line;
+                       head->ValidSize = __Bytes;
                        Mutex_Release(&glHeap); // Release spinlock
                        #if DEBUG_TRACE
                        Log("[Heap   ] Malloc'd %p (%i bytes), returning to %p", best->Data, best->Size, __builtin_return_address(0));

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