From 7b67ed0b5a90d5288c66c132f210883dece99181 Mon Sep 17 00:00:00 2001 From: Yinan Zhang Date: Tue, 14 Jan 2020 16:10:23 -0800 Subject: [PATCH] Get rid of lock overlap in prof_recent_alloc_reset --- src/prof_recent.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/prof_recent.c b/src/prof_recent.c index 0ae449f5..a53f82c7 100644 --- a/src/prof_recent.c +++ b/src/prof_recent.c @@ -182,12 +182,15 @@ prof_recent_alloc_reset(tsd_t *tsd, edata_t *edata) { if (dalloc_tctx != NULL) { nstime_update(&recent->dalloc_time); recent->dalloc_tctx = dalloc_tctx; + dalloc_tctx = NULL; } - } else if (dalloc_tctx != NULL) { + } + malloc_mutex_unlock(tsd_tsdn(tsd), &prof_recent_alloc_mtx); + + if (dalloc_tctx != NULL) { /* We lost the rase - the allocation record was just gone. */ decrement_recent_count(tsd, dalloc_tctx); } - malloc_mutex_unlock(tsd_tsdn(tsd), &prof_recent_alloc_mtx); } static void