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
This commit is contained in:
Michael Lotz 2008-02-12 22:25:18 +00:00
parent e6b529a362
commit cf2687e48f
1 changed files with 2 additions and 1 deletions

View File

@ -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