Skip to content

Commit

Permalink
bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235)
Browse files Browse the repository at this point in the history
(cherry picked from commit d51a363)

Co-authored-by: Brandt Bucher <[email protected]>
  • Loading branch information
miss-islington and brandtbucher authored Nov 20, 2019
1 parent 2ea4c37 commit daf7a08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Modules/_tracemalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1637,8 +1637,10 @@ PyInit__tracemalloc(void)
if (m == NULL)
return NULL;

if (tracemalloc_init() < 0)
if (tracemalloc_init() < 0) {
Py_DECREF(m);
return NULL;
}

return m;
}
Expand Down

0 comments on commit daf7a08

Please sign in to comment.