Skip to content

Commit 86a0f22

Browse files
Fix a possible "double decref" in termios.tcgetattr(). (GH-10194)
(cherry picked from commit 53835e9) Co-authored-by: Zackery Spytz <[email protected]>
1 parent 9bdadc1 commit 86a0f22

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
@@ -113,11 +113,11 @@ termios_tcgetattr(PyObject *self, PyObject *args)
113113
PyList_SetItem(v, 3, PyLong_FromLong((long)mode.c_lflag));
114114
PyList_SetItem(v, 4, PyLong_FromLong((long)ispeed));
115115
PyList_SetItem(v, 5, PyLong_FromLong((long)ospeed));
116-
PyList_SetItem(v, 6, cc);
117-
if (PyErr_Occurred()){
116+
if (PyErr_Occurred()) {
118117
Py_DECREF(v);
119118
goto err;
120119
}
120+
PyList_SetItem(v, 6, cc);
121121
return v;
122122
err:
123123
Py_DECREF(cc);

0 commit comments

Comments
 (0)