summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-03-30 06:58:41 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-03-30 06:58:41 (GMT)
commit04d09ebd396d2a87ad7204e170c1149edc9b141d (patch)
tree4ed8e3c9ab9d57a0e0413ce4ad064872d353017f
parent4aa867959f19ce92ccf999aa9f9dc4bd0b49ead7 (diff)
downloadcpython-04d09ebd396d2a87ad7204e170c1149edc9b141d.zip
cpython-04d09ebd396d2a87ad7204e170c1149edc9b141d.tar.gz
cpython-04d09ebd396d2a87ad7204e170c1149edc9b141d.tar.bz2
Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances.
-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 3f01980..d1c0d01 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -2435,14 +2435,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;
}