]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-117953: Fix Refleaks Introduced by gh-118194 (gh-118250)
authorEric Snow <ericsnowcurrently@gmail.com>
Wed, 24 Apr 2024 21:23:45 +0000 (15:23 -0600)
committerGitHub <noreply@github.com>
Wed, 24 Apr 2024 21:23:45 +0000 (21:23 +0000)
A couple of refleaks slipped through in gh-118194. This takes care of them.

(AKA _Py_ext_module_loader_info_init() does not steal references.)

Python/importdl.c

index 65370249493325ebab198fc073235dfb2192a722..f2ad95fbbb507da4f9bd074aff37c037a03d2360 100644 (file)
@@ -169,9 +169,13 @@ _Py_ext_module_loader_info_init_from_spec(
     }
     PyObject *filename = PyObject_GetAttrString(spec, "origin");
     if (filename == NULL) {
+        Py_DECREF(name);
         return -1;
     }
-    return _Py_ext_module_loader_info_init(p_info, name, filename);
+    int err = _Py_ext_module_loader_info_init(p_info, name, filename);
+    Py_DECREF(name);
+    Py_DECREF(filename);
+    return err;
 }