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

(cherry picked from commit d51a363a43)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-11-20 02:26:48 -08:00 committed by GitHub
parent 2ea4c37c1e
commit daf7a082b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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;
}