summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorauxten <auxten@users.noreply.github.com>2023-05-03 13:25:12 +0800
committerQi Wang <interwq@gmail.com>2023-05-10 17:18:22 -0700
commit019cccc293f96c9f7886373d816aab061f65f7de (patch)
treedae183cf3ba5288c74e6841cb0368eaa436741bc
parentdc0a184f8d349546af6a051eb87be47715eacff3 (diff)
downloadjemalloc-019cccc293f96c9f7886373d816aab061f65f7de.tar.gz
Make arenas_lookup_ctl triable
-rw-r--r--src/ctl.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ctl.c b/src/ctl.c
index 61511d34..e7d6529e 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -3215,19 +3215,21 @@ arenas_lookup_ctl(tsd_t *tsd, const size_t *mib,
int ret;
unsigned arena_ind;
void *ptr;
- edata_t *edata;
+ emap_full_alloc_ctx_t alloc_ctx;
+ bool ptr_not_present;
arena_t *arena;
ptr = NULL;
ret = EINVAL;
malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
WRITE(ptr, void *);
- edata = emap_edata_lookup(tsd_tsdn(tsd), &arena_emap_global, ptr);
- if (edata == NULL) {
+ ptr_not_present = emap_full_alloc_ctx_try_lookup(tsd_tsdn(tsd), &arena_emap_global, ptr,
+ &alloc_ctx);
+ if (ptr_not_present) {
goto label_return;
}
- arena = arena_get_from_edata(edata);
+ arena = arena_get_from_edata(alloc_ctx.edata);
if (arena == NULL) {
goto label_return;
}