mirror of
https://github.com/gperftools/gperftools
synced 2025-02-20 06:06:50 +00:00
make debugallocation calloc hook invocation order consistent
I.e. we normally call new hook just before returning. In calloc's case this means after zeroing allocated memory.
This commit is contained in:
parent
bc2aac871a
commit
13aecbe197
@ -1279,8 +1279,8 @@ extern "C" PERFTOOLS_DLL_DECL void* tc_calloc(size_t count, size_t size) PERFTOO
|
||||
if (size != 0 && total_size / size != count) return NULL;
|
||||
|
||||
void* block = do_debug_malloc_or_debug_cpp_alloc(total_size);
|
||||
MallocHook::InvokeNewHook(block, total_size);
|
||||
if (block) memset(block, 0, total_size);
|
||||
MallocHook::InvokeNewHook(block, total_size);
|
||||
return block;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user