Skip to content

Commit 1d7245c

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 63f09e7 commit 1d7245c

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
@@ -1655,8 +1655,10 @@ PyInit__tracemalloc(void)
16551655
if (m == NULL)
16561656
return NULL;
16571657

1658-
if (tracemalloc_init() < 0)
1658+
if (tracemalloc_init() < 0) {
1659+
Py_DECREF(m);
16591660
return NULL;
1661+
}
16601662

16611663
return m;
16621664
}

0 commit comments

Comments
 (0)