diff --git a/mem/mem0mem.c b/mem/mem0mem.c index bccdaa39ceb..5ea6c188dbd 100644 --- a/mem/mem0mem.c +++ b/mem/mem0mem.c @@ -511,14 +511,6 @@ mem_heap_block_free( init_block = block->init_block; block->magic_n = MEM_FREED_BLOCK_MAGIC_N; -#ifdef UNIV_MEM_DEBUG - /* In the debug version we set the memory to a random combination - of hex 0xDE and 0xAD. */ - - mem_erase_buf((byte*)block, len); - -#endif - if (init_block) { /* Do not have to free: do nothing */ @@ -536,6 +528,13 @@ mem_heap_block_free( mem_area_free(block, mem_comm_pool); } } + +#ifdef UNIV_MEM_DEBUG + /* In the debug version we set the memory to a random combination + of hex 0xDE and 0xAD. */ + + mem_erase_buf((byte*)block, len); +#endif } /**********************************************************************