]> granicus.if.org Git - python/commitdiff
Fix a possbile refleak in setint() of mmapmodule.c (GH-16136)
authorHai Shi <shihai1992@gmail.com>
Mon, 16 Sep 2019 05:56:57 +0000 (00:56 -0500)
committerXiang Zhang <angwerzx@126.com>
Mon, 16 Sep 2019 05:56:57 +0000 (13:56 +0800)
Modules/mmapmodule.c

index 51ab3f054f24f62ec032a49a567b32549111ee1d..0c641636a1a8307b5a79cc82c9bfc060997be56c 100644 (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);
     }
 }