[3.11] Fix refleak in super_descr_get (GH-104440)

(cherry picked from commit a781484c8e)
This commit is contained in:
Brandt Bucher 2023-05-12 15:29:02 -07:00 committed by GitHub
parent b90c922f3f
commit 4ade7c3369
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View 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;