]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40071: Fix refleak in _functools module (GH19172)
authorPaulo Henrique Silva <ph.silva@carta.com>
Thu, 26 Mar 2020 12:47:45 +0000 (09:47 -0300)
committerGitHub <noreply@github.com>
Thu, 26 Mar 2020 12:47:45 +0000 (13:47 +0100)
Modules/_functoolsmodule.c

index 2e27d48b147532baa67e5b6563dfef49f950ce19..dbe022e91d18f129e6f8dfc83f9c04eb1f796208 100644 (file)
@@ -1424,9 +1424,11 @@ _functools_exec(PyObject *module)
         &lru_cache_type
     };
 
-    kwd_mark = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type);
     if (!kwd_mark) {
-        return -1;
+        kwd_mark = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type);
+        if (!kwd_mark) {
+            return -1;
+        }
     }
 
     for (size_t i = 0; i < Py_ARRAY_LENGTH(typelist); i++) {