]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[2.7] bpo-38168: Fix a possbile refleak in setint() of mmapmodule.c (GH-16136) (GH...
authorXiang Zhang <angwerzx@126.com>
Mon, 16 Sep 2019 07:07:32 +0000 (15:07 +0800)
committerGitHub <noreply@github.com>
Mon, 16 Sep 2019 07:07:32 +0000 (15:07 +0800)
(cherry picked from commit 56a4514)

Co-authored-by: Hai Shi shihai1992@gmail.com
https://bugs.python.org/issue38168

Modules/mmapmodule.c

index 02b31ca438a911d3731816a0e3355978899dd6e3..57cc40c53fd6f0c9068a58a522785e6c1741ff0e 100644 (file)
@@ -1436,7 +1436,8 @@ static void
 setint(PyObject *d, const char *name, long value)
 {
     PyObject *o = PyInt_FromLong(value);
-    if (o && PyDict_SetItemString(d, name, o) == 0) {
+    if (o) {
+        PyDict_SetItemString(d, name, o);
         Py_DECREF(o);
     }
 }