]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.7] bpo-38168: Fix a possbile refleak in setint() of mmapmodule.c (GH-16136) (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 16 Sep 2019 06:27:38 +0000 (23:27 -0700)
committerGitHub <noreply@github.com>
Mon, 16 Sep 2019 06:27:38 +0000 (23:27 -0700)
(cherry picked from commit 56a45142e70a1ccf3233d43cb60c47255252e89a)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
Automerge-Triggered-By: @zhangyangyu
Modules/mmapmodule.c

index 223afacf3140f9e2f5c4a0e21bd34488b40bc480..37a5c3dade8edb0d0e419456d176e60a0bde4482 100644 (file)
@@ -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);
     }
 }