summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-11-20 02:26:54 -0800
committerGitHub <noreply@github.com>2019-11-20 02:26:54 -0800
commit1d7245c3e0cfe4508855c5025b25d8894155ecc5 (patch)
tree0ecfdee44d1e7a6aa2412e9dc5c4c94bc91ac58b
parent63f09e7628bd72f1bb2106226655b1f775757806 (diff)
downloadcpython-git-1d7245c3e0cfe4508855c5025b25d8894155ecc5.tar.gz
bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235)
(cherry picked from commit d51a363a4379385fdfe9c09a56324631465ede29) Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
-rw-r--r--Modules/_tracemalloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c
index 7f19c55981..1fe72a8a46 100644
--- a/Modules/_tracemalloc.c
+++ b/Modules/_tracemalloc.c
@@ -1655,8 +1655,10 @@ PyInit__tracemalloc(void)
if (m == NULL)
return NULL;
- if (tracemalloc_init() < 0)
+ if (tracemalloc_init() < 0) {
+ Py_DECREF(m);
return NULL;
+ }
return m;
}