From 341754928416cd0b28387fcd48d4ebf7f5cd6a9a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 18 Nov 2019 08:38:12 -0800 Subject: [PATCH 1/2] Clean up refleak in module initialization. --- Modules/_tracemalloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 211c6fbb8bcef8..92c773feb69210 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; } From 7ac9cd76c2dbe8e29d41807fdd9657c79f86ab7c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 18 Nov 2019 08:41:10 -0800 Subject: [PATCH 2/2] Fix typo. --- Modules/_tracemalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 92c773feb69210..70219721b51cd0 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -1657,7 +1657,7 @@ PyInit__tracemalloc(void) return NULL; if (tracemalloc_init() < 0) { - PY_DECREF(m); + Py_DECREF(m); return NULL; }