From: Xiang Zhang Date: Mon, 16 Sep 2019 07:07:32 +0000 (+0800) Subject: [2.7] bpo-38168: Fix a possbile refleak in setint() of mmapmodule.c (GH-16136) (GH... X-Git-Tag: v2.7.17rc1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68d8c122972d7a49627b983af4ccbfad9f5ade17;p=thirdparty%2FPython%2Fcpython.git [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 --- diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 02b31ca438a9..57cc40c53fd6 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); } }