Fix locking on arena_i_destroy_ctl().

The ctl_mtx should be held to protect against concurrent arenas.create.
This commit is contained in:
Qi Wang 2021-03-19 22:50:22 -07:00 committed by Qi Wang
parent 9193ea2248
commit 61afb6a405

View File

@ -2650,6 +2650,8 @@ arena_i_destroy_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
arena_t *arena;
ctl_arena_t *ctl_darena, *ctl_arena;
malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
ret = arena_i_reset_destroy_helper(tsd, mib, miblen, oldp, oldlenp,
newp, newlen, &arena_ind, &arena);
if (ret != 0) {
@ -2680,6 +2682,8 @@ arena_i_destroy_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
assert(ret == 0);
label_return:
malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);
return ret;
}