diff --git a/Objects/typeobject.c b/Objects/typeobject.c index e559c643ec9..403f3caaee6 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4962,6 +4962,7 @@ add_getset(PyTypeObject *type, PyGetSetDef *gsp) return -1; if (PyDict_GetItemWithError(dict, PyDescr_NAME(descr))) { + Py_DECREF(descr); continue; } else if (PyErr_Occurred()) { @@ -7689,6 +7690,7 @@ super_getattro(PyObject *self, PyObject *name) return res; } else if (PyErr_Occurred()) { + Py_DECREF(mro); return NULL; }