Skip to content

Commit 39f5875

Browse files
committed
Fix a potential tsd cleanup leak.
Prior to 767d850 (Refactor arenas array (fixes deadlock).), it was possible under some circumstances for arena_get() to trigger recreation of the arenas cache during tsd cleanup, and the arenas cache would then be leaked. In principle a similar issue could still occur as a side effect of decay-based purging, which calls arena_tdata_get(). Fix arenas_tdata_cleanup() by setting tsd->arenas_tdata_bypass to true, so that arena_tdata_get() will gracefully fail (an expected behavior) rather than recreating tsd->arena_tdata. Reported by Christopher Ferris <[email protected]>.
1 parent 3c07f80 commit 39f5875

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/jemalloc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,9 @@ arenas_tdata_cleanup(tsd_t *tsd)
652652
{
653653
arena_tdata_t *arenas_tdata;
654654

655+
/* Prevent tsd->arenas_tdata from being (re)created. */
656+
*tsd_arenas_tdata_bypassp_get(tsd) = true;
657+
655658
arenas_tdata = tsd_arenas_tdata_get(tsd);
656659
if (arenas_tdata != NULL) {
657660
tsd_arenas_tdata_set(tsd, NULL);

0 commit comments

Comments
 (0)