From 7a1baf20fbc369a9d66f56d132c785482d48fbe1 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 May 2023 00:11:27 -0700 Subject: [PATCH] [3.11] Fix refleak in `super_descr_get` (GH-104408). (cherry picked from commit a781484c8e9834538e5ee7b9e2e6bec7b679e033) Co-authored-by: Brandt Bucher --- Objects/typeobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 90c6425ffdfea5..782a7e9722883e 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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;