[Python-checkins] [2.7] bpo-38168: Fix a possbile refleak in setint() of mmapmodule.c (GH-16136) (GH-16176)

Xiang Zhang webhook-mailer at python.org
Mon Sep 16 03:07:36 EDT 2019


https://github.com/python/cpython/commit/68d8c122972d7a49627b983af4ccbfad9f5ade17
commit: 68d8c122972d7a49627b983af4ccbfad9f5ade17
branch: 2.7
author: Xiang Zhang <angwerzx at 126.com>
committer: GitHub <noreply at github.com>
date: 2019-09-16T15:07:32+08:00
summary:

[2.7] bpo-38168: Fix a possbile refleak in setint() of mmapmodule.c (GH-16136) (GH-16176)

(cherry picked from commit 56a4514)

Co-authored-by: Hai Shi shihai1992 at gmail.com

https://bugs.python.org/issue38168

files:
M Modules/mmapmodule.c

diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 02b31ca438a9..57cc40c53fd6 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -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);
     }
 }



More information about the Python-checkins mailing list