summaryrefslogtreecommitdiffstats
path: root/Python/importdl.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-04-24 21:23:45 (GMT)
committerGitHub <noreply@github.com>2024-04-24 21:23:45 (GMT)
commit85ec1c2dc67c2a506e847dbe2c3c740e81c3ab9b (patch)
treed58222367b699c9f4dbebc540be803c19405d995 /Python/importdl.c
parent345e1e04ec72698a1e257c805b3840d9f55eb80d (diff)
downloadcpython-85ec1c2dc67c2a506e847dbe2c3c740e81c3ab9b.zip
cpython-85ec1c2dc67c2a506e847dbe2c3c740e81c3ab9b.tar.gz
cpython-85ec1c2dc67c2a506e847dbe2c3c740e81c3ab9b.tar.bz2
gh-117953: Fix Refleaks Introduced by gh-118194 (gh-118250)
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.)
Diffstat (limited to 'Python/importdl.c')
-rw-r--r--Python/importdl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/importdl.c b/Python/importdl.c
index 6537024..f2ad95f 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -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;
}