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
  • Loading branch information
brandtbucher authored and vstinner committed Nov 20, 2019
1 parent 7eee5be commit d51a363
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 @@ -1656,8 +1656,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 d51a363

Please sign in to comment.