summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHai Shi <shihai1992@gmail.com>2019-09-16 00:56:57 -0500
committerXiang Zhang <angwerzx@126.com>2019-09-16 13:56:57 +0800
commit56a45142e70a1ccf3233d43cb60c47255252e89a (patch)
tree6c16820011e893cc9a19976c01ce2657c254d238
parent24d1597e430498ebe2d3d18fba2cacb3957b494d (diff)
downloadcpython-git-56a45142e70a1ccf3233d43cb60c47255252e89a.tar.gz
Fix a possbile refleak in setint() of mmapmodule.c (GH-16136)
-rw-r--r--Modules/mmapmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 51ab3f054f..0c641636a1 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -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);
}
}