Commit dea76966 authored by marko's avatar marko

branches/zip: mem_heap_free_heap_top(): Declare the memory

freed with UNIV_MEM_FREE().  Before this change, the memory
freed by mem_heap_empty() was not completely flagged free
in UNIV_DEBUG_VALGRIND builds.  After this change, Valgrind
will hopefully catch all errors caught by UNIV_MEM_DEBUG.
parent 4dfa0cc9
......@@ -285,15 +285,19 @@ mem_heap_free_heap_top(
ut_ad(mem_block_get_start(block) <= mem_block_get_free(block));
/* In the debug version erase block from top up */
mem_erase_buf(old_top, (byte*)block + block->len - old_top);
{
ulint len = (byte*)block + block->len - old_top;
mem_erase_buf(old_top, len);
UNIV_MEM_FREE(old_top, len);
}
/* Update allocated memory count */
mutex_enter(&mem_hash_mutex);
mem_current_allocated_memory -= (total_size - size);
mutex_exit(&mem_hash_mutex);
#endif
#else /* UNIV_MEM_DEBUG */
UNIV_MEM_FREE(old_top, (byte*)block + block->len - old_top);
#endif /* UNIV_MEM_DEBUG */
/* If free == start, we may free the block if it is not the first
one */
......
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