From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 29 Oct 2018 05:17:45 +0000 (-0700) Subject: Fix a possible "double decref" in termios.tcgetattr(). (GH-10194) X-Git-Tag: v3.7.2rc1~208 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f00703d29438b5f2e9524b04a247167f042a50ef;p=thirdparty%2FPython%2Fcpython.git Fix a possible "double decref" in termios.tcgetattr(). (GH-10194) (cherry picked from commit 53835e92d315340444e3dd083b3f69a590b00e07) Co-authored-by: Zackery Spytz --- diff --git a/Modules/termios.c b/Modules/termios.c index b4aa77f89764..7601b68afda3 100644 --- a/Modules/termios.c +++ b/Modules/termios.c @@ -119,11 +119,11 @@ termios_tcgetattr(PyObject *self, PyObject *args) PyList_SetItem(v, 3, PyLong_FromLong((long)mode.c_lflag)); PyList_SetItem(v, 4, PyLong_FromLong((long)ispeed)); PyList_SetItem(v, 5, PyLong_FromLong((long)ospeed)); - PyList_SetItem(v, 6, cc); - if (PyErr_Occurred()){ + if (PyErr_Occurred()) { Py_DECREF(v); goto err; } + PyList_SetItem(v, 6, cc); return v; err: Py_DECREF(cc);