Commit 6e3038b6 authored by marko's avatar marko

branches/zip: mem_heap_block_free(): Fix a bug introduced in r914

while trying to fix r909: invoke mem_erase_buf() before freeing the
buffer, but after interpreting block->buf_block.
parent 98a82972
......@@ -492,6 +492,7 @@ mem_heap_block_free(
ulint type;
ulint len;
ibool init_block;
buf_block_t* buf_block;
if (block->magic_n != MEM_BLOCK_MAGIC_N) {
mem_analyze_corruption(block);
......@@ -509,32 +510,33 @@ mem_heap_block_free(
type = heap->type;
len = block->len;
init_block = block->init_block;
buf_block = block->buf_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 */
} else if (type == MEM_HEAP_DYNAMIC) {
ut_ad(!block->buf_block);
ut_ad(!buf_block);
mem_area_free(block, mem_comm_pool);
} else {
ut_ad(type & MEM_HEAP_BUFFER);
if (len >= UNIV_PAGE_SIZE / 2) {
buf_block_free(block->buf_block);
buf_block_free(buf_block);
} else {
ut_ad(!block->buf_block);
ut_ad(!buf_block);
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
}
/**********************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment