Skip to content

Commit daf7a08

Browse files
bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235)
(cherry picked from commit d51a363) Co-authored-by: Brandt Bucher <[email protected]>
1 parent 2ea4c37 commit daf7a08

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Modules/_tracemalloc.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1637,8 +1637,10 @@ PyInit__tracemalloc(void)
16371637
if (m == NULL)
16381638
return NULL;
16391639

1640-
if (tracemalloc_init() < 0)
1640+
if (tracemalloc_init() < 0) {
1641+
Py_DECREF(m);
16411642
return NULL;
1643+
}
16421644

16431645
return m;
16441646
}

0 commit comments

Comments
 (0)