fix zero initialization in mi_arena_meta_zalloc, issue #750

This commit is contained in:
daanx 2023-05-19 21:18:40 -07:00
parent 7563ab97ed
commit cfacbacaba
1 changed files with 7 additions and 1 deletions

View File

@ -176,7 +176,13 @@ static void* mi_arena_meta_zalloc(size_t size, mi_memid_t* memid, mi_stats_t* st
if (p != NULL) return p;
// or fall back to the OS
return _mi_os_alloc(size, memid, stats);
p = _mi_os_alloc(size, memid, stats);
if (p == NULL) return NULL;
if (!memid->initially_zero) {
_mi_memzero_aligned(p, size);
}
return p;
}
static void mi_arena_meta_free(void* p, mi_memid_t memid, size_t size, mi_stats_t* stats) {