summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorXiang Zhang <angwerzx@126.com>2019-09-16 07:07:32 (GMT)
committerGitHub <noreply@github.com>2019-09-16 07:07:32 (GMT)
commit68d8c122972d7a49627b983af4ccbfad9f5ade17 (patch)
treec5acf21b6060cae3e1fe0b7514c10c8b1a039962 /Modules
parent8dd358caf0d3f300ee64799812a020fe0de53637 (diff)
downloadcpython-68d8c122972d7a49627b983af4ccbfad9f5ade17.zip
cpython-68d8c122972d7a49627b983af4ccbfad9f5ade17.tar.gz
cpython-68d8c122972d7a49627b983af4ccbfad9f5ade17.tar.bz2
[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@gmail.com https://bugs.python.org/issue38168
Diffstat (limited to 'Modules')
-rw-r--r--Modules/mmapmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 02b31ca..57cc40c 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);
}
}