Fix memory leak when MALLOC_DEBUG is enabled.