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

Miss Islington (bot) webhook-mailer at python.org
Mon Sep 16 02:27:42 EDT 2019


https://github.com/python/cpython/commit/e857fe624d985616f3e1a6e095a5db732e6b3efe
commit: e857fe624d985616f3e1a6e095a5db732e6b3efe
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-09-15T23:27:38-07:00
summary:

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



(cherry picked from commit 56a45142e70a1ccf3233d43cb60c47255252e89a)


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

Automerge-Triggered-By: @zhangyangyu

files:
M Modules/mmapmodule.c

diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 223afacf3140..37a5c3dade8e 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -1392,7 +1392,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);
     }
 }



More information about the Python-checkins mailing list