Fix a possbile refleak in setint() of mmapmodule.c (GH-16136)

This commit is contained in:
Hai Shi 2019-09-16 00:56:57 -05:00 committed by Xiang Zhang
parent 24d1597e43
commit 56a45142e7
1 changed files with 2 additions and 1 deletions

View File

@ -1468,7 +1468,8 @@ static void
setint(PyObject *d, const char *name, long value)
{
PyObject *o = PyLong_FromLong(value);
if (o && PyDict_SetItemString(d, name, o) == 0) {
if (o) {
PyDict_SetItemString(d, name, o);
Py_DECREF(o);
}
}