Fix refleak in `super_descr_get` (#104408)

This commit is contained in:
Brandt Bucher 2023-05-12 00:11:27 -07:00 committed by GitHub
parent 3c2992e58b
commit a781484c8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -10277,8 +10277,10 @@ super_descr_get(PyObject *self, PyObject *obj, PyObject *type)
return NULL; return NULL;
newobj = (superobject *)PySuper_Type.tp_new(&PySuper_Type, newobj = (superobject *)PySuper_Type.tp_new(&PySuper_Type,
NULL, NULL); NULL, NULL);
if (newobj == NULL) if (newobj == NULL) {
Py_DECREF(obj_type);
return NULL; return NULL;
}
newobj->type = (PyTypeObject*)Py_NewRef(su->type); newobj->type = (PyTypeObject*)Py_NewRef(su->type);
newobj->obj = Py_NewRef(obj); newobj->obj = Py_NewRef(obj);
newobj->obj_type = obj_type; newobj->obj_type = obj_type;