[Python-checkins] Fix a possbile refleak in setint() of mmapmodule.c (GH-16136)

Xiang Zhang webhook-mailer at python.org
Mon Sep 16 01:57:20 EDT 2019


https://github.com/python/cpython/commit/56a45142e70a1ccf3233d43cb60c47255252e89a
commit: 56a45142e70a1ccf3233d43cb60c47255252e89a
branch: master
author: Hai Shi <shihai1992 at gmail.com>
committer: Xiang Zhang <angwerzx at 126.com>
date: 2019-09-16T13:56:57+08:00
summary:

Fix a possbile refleak in setint() of mmapmodule.c (GH-16136)

files:
M Modules/mmapmodule.c

diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 51ab3f054f24..0c641636a1a8 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);
     }
 }



More information about the Python-checkins mailing list