From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 20 Nov 2019 10:26:54 +0000 (-0800) Subject: bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235) X-Git-Tag: v3.7.6rc1~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1d7245c3e0cfe4508855c5025b25d8894155ecc5;p=thirdparty%2FPython%2Fcpython.git bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235) (cherry picked from commit d51a363a4379385fdfe9c09a56324631465ede29) Co-authored-by: Brandt Bucher --- diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 7f19c5598120..1fe72a8a4627 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; }