Fix a possible "double decref" in termios.tcgetattr(). (GH-10194)

This commit is contained in:
Zackery Spytz 2018-10-28 22:55:20 -06:00 committed by Serhiy Storchaka
parent ea9c8bd443
commit 53835e92d3
1 changed files with 2 additions and 2 deletions

View File

@ -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);