From a781484c8e9834538e5ee7b9e2e6bec7b679e033 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 May 2023 00:11:27 -0700 Subject: [PATCH] Fix refleak in `super_descr_get` (#104408) --- Objects/typeobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index f40e197f8c2..a1ad5021c41 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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;