summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-09-16 06:26:57 (GMT)
committerGitHub <noreply@github.com>2019-09-16 06:26:57 (GMT)
commit322309efe658122cac340adf4995ce40fa0c2e74 (patch)
tree1843d9d6cd9faec9f15f0c7fa720f1d59a1c5026 /Modules
parent346b7c928b82d9da8f6654391e9cfe55625dcfac (diff)
downloadcpython-322309efe658122cac340adf4995ce40fa0c2e74.zip
cpython-322309efe658122cac340adf4995ce40fa0c2e74.tar.gz
cpython-322309efe658122cac340adf4995ce40fa0c2e74.tar.bz2
[3.8] bpo-38168: Fix a possbile refleak in setint() of mmapmodule.c (GH-16136) (GH-16174)
(cherry picked from commit 56a45142e70a1ccf3233d43cb60c47255252e89a) Co-authored-by: Hai Shi <shihai1992@gmail.com> https://bugs.python.org/issue38168 Automerge-Triggered-By: @zhangyangyu
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 9e3414f..1875886 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);
}
}