bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235)

This commit is contained in:
Brandt Bucher 2019-11-20 02:00:31 -08:00 committed by Victor Stinner
parent 7eee5beaf8
commit d51a363a43
1 changed files with 3 additions and 1 deletions

View File

@ -1656,8 +1656,10 @@ PyInit__tracemalloc(void)
if (m == NULL) if (m == NULL)
return NULL; return NULL;
if (tracemalloc_init() < 0) if (tracemalloc_init() < 0) {
Py_DECREF(m);
return NULL; return NULL;
}
return m; return m;
} }