From c15660054f70c69d8b4f72a4ad98d4bd59301023 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 26 Jan 2010 14:30:25 +0100 Subject: [PATCH] ntdll: Use the same value as Windows for filling free heap blocks. --- dlls/ntdll/heap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 2f459433af7..d8291b86aa3 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -85,7 +85,7 @@ typedef struct #define ARENA_INUSE_FILLER 0x55 #define ARENA_TAIL_FILLER 0xab -#define ARENA_FREE_FILLER 0xaa +#define ARENA_FREE_FILLER 0xfeeefeee /* everything is aligned on 8 byte boundaries (16 for Win64) */ #define ALIGNMENT (2*sizeof(void*)) @@ -169,7 +169,11 @@ static BOOL HEAP_IsRealArena( HEAP *heapPtr, DWORD flags, LPCVOID block, BOOL qu /* mark a block of memory as free for debugging purposes */ static inline void mark_block_free( void *ptr, SIZE_T size, DWORD flags ) { - if (flags & HEAP_FREE_CHECKING_ENABLED) memset( ptr, ARENA_FREE_FILLER, size ); + if (flags & HEAP_FREE_CHECKING_ENABLED) + { + SIZE_T i; + for (i = 0; i < size / sizeof(DWORD); i++) ((DWORD *)ptr)[i] = ARENA_FREE_FILLER; + } #if defined(VALGRIND_MAKE_MEM_NOACCESS) VALGRIND_DISCARD( VALGRIND_MAKE_MEM_NOACCESS( ptr, size )); #elif defined( VALGRIND_MAKE_NOACCESS)