From: Brandt Bucher Date: Wed, 20 Nov 2019 10:00:31 +0000 (-0800) Subject: bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235) X-Git-Tag: v3.9.0a2~172 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d51a363a4379385fdfe9c09a56324631465ede29;p=thirdparty%2FPython%2Fcpython.git bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235) --- diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 211c6fbb8bce..70219721b51c 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; }