From: Eric Snow Date: Wed, 24 Apr 2024 21:23:45 +0000 (-0600) Subject: gh-117953: Fix Refleaks Introduced by gh-118194 (gh-118250) X-Git-Tag: v3.13.0b1~277 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85ec1c2dc67c2a506e847dbe2c3c740e81c3ab9b;p=thirdparty%2FPython%2Fcpython.git 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.) --- diff --git a/Python/importdl.c b/Python/importdl.c index 653702494933..f2ad95fbbb50 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; }