X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Usermode%2FLibraries%2Flibc.so_src%2Fheap.c;h=1c0c7acfa4348b984da7d794b9fbf59e54086964;hb=847cf5210b02bfef53758f0e0f49c0f2990a2a09;hp=d529f658344e33e2607b528eb573fb60cebc9227;hpb=fb3abbad5dfd71ea2b190d0b33d9c57e879fb15a;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libc.so_src/heap.c b/Usermode/Libraries/libc.so_src/heap.c index d529f658..1c0c7acf 100644 --- a/Usermode/Libraries/libc.so_src/heap.c +++ b/Usermode/Libraries/libc.so_src/heap.c @@ -94,13 +94,16 @@ EXPORT void *malloc(size_t bytes) //Corrupt Heap Heap_Dump(); _SysDebug("malloc: Corrupt Heap\n"); + exit(128); return NULL; } curBlock = (heap_head*)((uintptr_t)curBlock + curBlock->size); } if((uintptr_t)curBlock < (uintptr_t)_heap_start) { + Heap_Dump(); _SysDebug("malloc: Heap underrun for some reason\n"); + exit(128); return NULL; } @@ -185,7 +188,7 @@ EXPORT void free(void *mem) DEBUGS("free(%p) : 0x%x bytes", mem, head->size); //Unify Right - if((intptr_t)head + head->size < (intptr_t)_heap_end) + if((uintptr_t)head + head->size < (uintptr_t)_heap_end) { heap_head *nextHead = (heap_head*)((intptr_t)head + head->size); if(nextHead->magic == MAGIC_FREE) { //Is the next block free @@ -194,7 +197,7 @@ EXPORT void free(void *mem) } } //Unify Left - if((intptr_t)head - sizeof(heap_foot) > (intptr_t)_heap_start) + if((uintptr_t)head - sizeof(heap_foot) > (uintptr_t)_heap_start) { heap_head *prevHead; heap_foot *prevFoot = (heap_foot *)((intptr_t)head - sizeof(heap_foot));