diff options
author | Brandt Bucher <brandtbucher@gmail.com> | 2019-11-20 10:00:31 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@python.org> | 2019-11-20 10:00:31 (GMT) |
commit | d51a363a4379385fdfe9c09a56324631465ede29 (patch) | |
tree | 227698e0b2cdecbbc0d9d4b87301c9e872657c6b /Modules/_tracemalloc.c | |
parent | 7eee5beaf87be898a679278c480e8dd0df76d351 (diff) | |
download | cpython-d51a363a4379385fdfe9c09a56324631465ede29.zip cpython-d51a363a4379385fdfe9c09a56324631465ede29.tar.gz cpython-d51a363a4379385fdfe9c09a56324631465ede29.tar.bz2 |
bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235)
Diffstat (limited to 'Modules/_tracemalloc.c')
-rw-r--r-- | Modules/_tracemalloc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 211c6fb..7021972 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -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; } |