From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 16 Sep 2019 06:27:38 +0000 (-0700) Subject: [3.7] bpo-38168: Fix a possbile refleak in setint() of mmapmodule.c (GH-16136) (GH... X-Git-Tag: v3.7.5rc1~48 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e857fe624d985616f3e1a6e095a5db732e6b3efe;p=thirdparty%2FPython%2Fcpython.git [3.7] bpo-38168: Fix a possbile refleak in setint() of mmapmodule.c (GH-16136) (GH-16175) (cherry picked from commit 56a45142e70a1ccf3233d43cb60c47255252e89a) Co-authored-by: Hai Shi Automerge-Triggered-By: @zhangyangyu --- diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 223afacf3140..37a5c3dade8e 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1392,7 +1392,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); } }