Commit 64ffee7a authored by Zackery Spytz's avatar Zackery Spytz Committed by Serhiy Storchaka

[2.7] Fix a possible "double decref" in termios.tcgetattr(). (GH-10194) (GH-10218)

(cherry picked from commit 53835e92)
parent 4ec427b0
...@@ -120,11 +120,11 @@ termios_tcgetattr(PyObject *self, PyObject *args) ...@@ -120,11 +120,11 @@ termios_tcgetattr(PyObject *self, PyObject *args)
PyList_SetItem(v, 3, PyInt_FromLong((long)mode.c_lflag)); PyList_SetItem(v, 3, PyInt_FromLong((long)mode.c_lflag));
PyList_SetItem(v, 4, PyInt_FromLong((long)ispeed)); PyList_SetItem(v, 4, PyInt_FromLong((long)ispeed));
PyList_SetItem(v, 5, PyInt_FromLong((long)ospeed)); PyList_SetItem(v, 5, PyInt_FromLong((long)ospeed));
PyList_SetItem(v, 6, cc); if (PyErr_Occurred()) {
if (PyErr_Occurred()){
Py_DECREF(v); Py_DECREF(v);
goto err; goto err;
} }
PyList_SetItem(v, 6, cc);
return v; return v;
err: err:
Py_DECREF(cc); Py_DECREF(cc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment