]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] Fix refleak in super_descr_get (GH-104440)
authorBrandt Bucher <brandtbucher@microsoft.com>
Fri, 12 May 2023 22:29:02 +0000 (15:29 -0700)
committerGitHub <noreply@github.com>
Fri, 12 May 2023 22:29:02 +0000 (22:29 +0000)
(cherry picked from commit a781484c8e9834538e5ee7b9e2e6bec7b679e033)

Objects/typeobject.c

index 90c6425ffdfea571b8748c1bab6f90276458cf96..782a7e9722883e2036d87320b919634b6a9f4a49 100644 (file)
@@ -8969,8 +8969,10 @@ super_descr_get(PyObject *self, PyObject *obj, PyObject *type)
             return NULL;
         newobj = (superobject *)PySuper_Type.tp_new(&PySuper_Type,
                                                  NULL, NULL);
-        if (newobj == NULL)
+        if (newobj == NULL) {
+            Py_DECREF(obj_type);
             return NULL;
+        }
         Py_INCREF(su->type);
         Py_INCREF(obj);
         newobj->type = su->type;