]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-116296: Fix refleak in reduce_newobj() corner case (#116297)
authorErlend E. Aasland <erlend@python.org>
Mon, 4 Mar 2024 09:46:18 +0000 (10:46 +0100)
committerGitHub <noreply@github.com>
Mon, 4 Mar 2024 09:46:18 +0000 (09:46 +0000)
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
Misc/NEWS.d/next/Core and Builtins/2024-03-04-10-19-51.gh-issue-116296.gvtxyU.rst [new file with mode: 0644]
Objects/typeobject.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-03-04-10-19-51.gh-issue-116296.gvtxyU.rst b/Misc/NEWS.d/next/Core and Builtins/2024-03-04-10-19-51.gh-issue-116296.gvtxyU.rst
new file mode 100644 (file)
index 0000000..0781e92
--- /dev/null
@@ -0,0 +1 @@
+Fix possible refleak in :meth:`!object.__reduce__` internal error handling.
index fe3b7b87c8b4b68962cc3df5ea962cff8fdfc078..181d0323284ebc63f2e39a8f75f2a264e702a5b1 100644 (file)
@@ -6549,6 +6549,7 @@ reduce_newobj(PyObject *obj)
     }
     else {
         /* args == NULL */
+        Py_DECREF(copyreg);
         Py_DECREF(kwargs);
         PyErr_BadInternalCall();
         return NULL;