From: Erlend E. Aasland Date: Mon, 4 Mar 2024 09:46:18 +0000 (+0100) Subject: gh-116296: Fix refleak in reduce_newobj() corner case (#116297) X-Git-Tag: v3.13.0a5~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17c4849981905fb1c9bfbb2b963b6ee12e3efb2c;p=thirdparty%2FPython%2Fcpython.git gh-116296: Fix refleak in reduce_newobj() corner case (#116297) Co-authored-by: Brandt Bucher --- 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 index 000000000000..0781e9282205 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2024-03-04-10-19-51.gh-issue-116296.gvtxyU.rst @@ -0,0 +1 @@ +Fix possible refleak in :meth:`!object.__reduce__` internal error handling. diff --git a/Objects/typeobject.c b/Objects/typeobject.c index fe3b7b87c8b4..181d0323284e 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6549,6 +6549,7 @@ reduce_newobj(PyObject *obj) } else { /* args == NULL */ + Py_DECREF(copyreg); Py_DECREF(kwargs); PyErr_BadInternalCall(); return NULL;