]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix refleak in `super_descr_get` (#104408)
authorBrandt Bucher <brandtbucher@microsoft.com>
Fri, 12 May 2023 07:11:27 +0000 (00:11 -0700)
committerGitHub <noreply@github.com>
Fri, 12 May 2023 07:11:27 +0000 (12:41 +0530)
Objects/typeobject.c

index f40e197f8c238a861235383a54f3faa6085c6f7f..a1ad5021c4150a3b8b29e7129203b4c357807385 100644 (file)
@@ -10277,8 +10277,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;
+        }
         newobj->type = (PyTypeObject*)Py_NewRef(su->type);
         newobj->obj = Py_NewRef(obj);
         newobj->obj_type = obj_type;