Skip to content

Commit 64ffee7

Browse files
ZackerySpytzserhiy-storchaka
authored andcommitted
[2.7] Fix a possible "double decref" in termios.tcgetattr(). (GH-10194) (GH-10218)
(cherry picked from commit 53835e9)
1 parent 4ec427b commit 64ffee7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/termios.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ termios_tcgetattr(PyObject *self, PyObject *args)
120120
PyList_SetItem(v, 3, PyInt_FromLong((long)mode.c_lflag));
121121
PyList_SetItem(v, 4, PyInt_FromLong((long)ispeed));
122122
PyList_SetItem(v, 5, PyInt_FromLong((long)ospeed));
123-
PyList_SetItem(v, 6, cc);
124-
if (PyErr_Occurred()){
123+
if (PyErr_Occurred()) {
125124
Py_DECREF(v);
126125
goto err;
127126
}
127+
PyList_SetItem(v, 6, cc);
128128
return v;
129129
err:
130130
Py_DECREF(cc);

0 commit comments

Comments
 (0)