]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.8] 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:26:57 +0000 (23:26 -0700)
committerGitHub <noreply@github.com>
Mon, 16 Sep 2019 06:26:57 +0000 (23:26 -0700)
(cherry picked from commit 56a45142e70a1ccf3233d43cb60c47255252e89a)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
https://bugs.python.org/issue38168

Automerge-Triggered-By: @zhangyangyu
Modules/mmapmodule.c

index 9e3414f94e3124b69de5b633c94b195280a190df..18758861a62e9c0d8c4a81cdfc5205a96125ffed 100644 (file)
@@ -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);
     }
 }