From 68d8c122972d7a49627b983af4ccbfad9f5ade17 Mon Sep 17 00:00:00 2001 From: Xiang Zhang Date: Mon, 16 Sep 2019 15:07:32 +0800 Subject: [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 --- Modules/mmapmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } } -- cgit v0.12