Skip to content

Commit f00703d

Browse files
Fix a possible "double decref" in termios.tcgetattr(). (GH-10194)
(cherry picked from commit 53835e9) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
1 parent 1a3f18e commit f00703d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Modules/termios.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ termios_tcgetattr(PyObject *self, PyObject *args)
119119
PyList_SetItem(v, 3, PyLong_FromLong((long)mode.c_lflag));
120120
PyList_SetItem(v, 4, PyLong_FromLong((long)ispeed));
121121
PyList_SetItem(v, 5, PyLong_FromLong((long)ospeed));
122-
PyList_SetItem(v, 6, cc);
123-
if (PyErr_Occurred()){
122+
if (PyErr_Occurred()) {
124123
Py_DECREF(v);
125124
goto err;
126125
}
126+
PyList_SetItem(v, 6, cc);
127127
return v;
128128
err:
129129
Py_DECREF(cc);

0 commit comments

Comments
 (0)