From 513c472be6af11bd59c07193be08547ad1daf8b6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 11 May 2023 16:23:42 -0700 Subject: [PATCH] Fix refleak in super_descr_get --- Objects/typeobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index f1745c91967358..9b51451ac47b7f 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -10267,8 +10267,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;