Mailing List Archive

gh-117953: Fix Refleaks Introduced by gh-118194 (gh-118250)
https://github.com/python/cpython/commit/85ec1c2dc67c2a506e847dbe2c3c740e81c3ab9b
commit: 85ec1c2dc67c2a506e847dbe2c3c740e81c3ab9b
branch: main
author: Eric Snow <ericsnowcurrently@gmail.com>
committer: ericsnowcurrently <ericsnowcurrently@gmail.com>
date: 2024-04-24T21:23:45Z
summary:

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.)

files:
M Python/importdl.c

diff --git a/Python/importdl.c b/Python/importdl.c
index 65370249493325..f2ad95fbbb507d 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;
}



_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-leave@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: list-python-checkins@lists.gossamer-threads.com