]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-116296: Fix refleak in reduce_newobj() corner case (GH-116297) (#116299)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 4 Mar 2024 10:04:44 +0000 (11:04 +0100)
committerGitHub <noreply@github.com>
Mon, 4 Mar 2024 10:04:44 +0000 (10:04 +0000)
(cherry picked from commit 17c4849981905fb1c9bfbb2b963b6ee12e3efb2c)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
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 71d20687479aab560fbce230449a5ef9bb354115..7776ae2b735c2b66012f66d2b9b25c08b061b742 100644 (file)
@@ -6258,6 +6258,7 @@ reduce_newobj(PyObject *obj)
     }
     else {
         /* args == NULL */
+        Py_DECREF(copyreg);
         Py_DECREF(kwargs);
         PyErr_BadInternalCall();
         return NULL;