summaryrefslogtreecommitdiffstats
path: root/Modules/_io/textio.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-03-30 07:00:40 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-03-30 07:00:40 (GMT)
commit2e1c4e5db2894ec4322f917e9babc4e37dca9244 (patch)
tree2afb6e263a642e4c17f7dee46f5787728c5c5f47 /Modules/_io/textio.c
parentbe1c60c3f68a0ec75727fda4811a6eeae3f19048 (diff)
parent04d09ebd396d2a87ad7204e170c1149edc9b141d (diff)
downloadcpython-2e1c4e5db2894ec4322f917e9babc4e37dca9244.zip
cpython-2e1c4e5db2894ec4322f917e9babc4e37dca9244.tar.gz
cpython-2e1c4e5db2894ec4322f917e9babc4e37dca9244.tar.bz2
Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances.
Diffstat (limited to 'Modules/_io/textio.c')
-rw-r--r--Modules/_io/textio.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index 9fb4ef9..af232bf 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -2441,14 +2441,10 @@ fail:
if (saved_state) {
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
-
res = _PyObject_CallMethodId(self->decoder, &PyId_setstate, "(O)", saved_state);
+ _PyErr_ChainExceptions(type, value, traceback);
Py_DECREF(saved_state);
- if (res == NULL)
- return NULL;
- Py_DECREF(res);
-
- PyErr_Restore(type, value, traceback);
+ Py_XDECREF(res);
}
return NULL;
}