diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c index b4a6e87f8c4..fd6f5e25577 100644 --- a/Modules/_ctypes/stgdict.c +++ b/Modules/_ctypes/stgdict.c @@ -457,11 +457,13 @@ StructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct) if (!prop) { Py_DECREF(pair); + Py_DECREF((PyObject *)stgdict); return -1; } if (-1 == PyDict_SetItem(realdict, name, prop)) { Py_DECREF(prop); Py_DECREF(pair); + Py_DECREF((PyObject *)stgdict); return -1; } Py_DECREF(pair);