summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-10-29 10:03:26 -0600
committerSerhiy Storchaka <storchaka@gmail.com>2018-10-29 18:03:26 +0200
commit64ffee7ad2655c7de9b3b6548aad0c317877ec49 (patch)
tree4dd0a5463da3461267bf9829c1ebc589fe31cfe7 /Modules
parent4ec427b005036dab0a380de20f31774394ca4dd6 (diff)
downloadcpython-git-64ffee7ad2655c7de9b3b6548aad0c317877ec49.tar.gz
[2.7] Fix a possible "double decref" in termios.tcgetattr(). (GH-10194) (GH-10218)
(cherry picked from commit 53835e92d315340444e3dd083b3f69a590b00e07)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/termios.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/termios.c b/Modules/termios.c
index e26e714e0e..4349df6481 100644
--- a/Modules/termios.c
+++ b/Modules/termios.c
@@ -120,11 +120,11 @@ termios_tcgetattr(PyObject *self, PyObject *args)
PyList_SetItem(v, 3, PyInt_FromLong((long)mode.c_lflag));
PyList_SetItem(v, 4, PyInt_FromLong((long)ispeed));
PyList_SetItem(v, 5, PyInt_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);