From cf2687e48f58b40c79b5b7b5fb95b611e5260ab2 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 12 Feb 2008 22:25:18 +0000 Subject: [PATCH] Only clear 0xdeadbeef if there is 0xdeadbeef present. The size field of the heap leak check info would otherwise be overwritten for allocations that still fit the 16 byte bin (i.e. allocations of 0-4 bytes). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23956 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/heap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/heap.cpp b/src/system/kernel/heap.cpp index 080b1695f6..6369556ef9 100644 --- a/src/system/kernel/heap.cpp +++ b/src/system/kernel/heap.cpp @@ -721,7 +721,8 @@ heap_memalign(heap_allocator *heap, size_t alignment, size_t size, #if PARANOID_KFREE // make sure 0xdeadbeef is cleared if we do not overwrite the memory // and the user does not clear it - ((uint32 *)address)[1] = 0xcccccccc; + if (((uint32 *)address)[1] == 0xdeadbeef) + ((uint32 *)address)[1] = 0xcccccccc; #endif #if PARANOID_KMALLOC