From: Serhiy Storchaka Date: Mon, 30 Mar 2015 07:00:49 +0000 (+0300) Subject: Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances. X-Git-Tag: v2.7.10rc1~89 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=96d80129643a72ea08a4f563054b7c3506b3af0d;p=thirdparty%2FPython%2Fcpython.git Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances. --- diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index 65c8d8d4e893..8ac8a4acdea6 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -2338,12 +2338,9 @@ textiowrapper_tell(textio *self, PyObject *args) PyErr_Fetch(&type, &value, &traceback); res = PyObject_CallMethod(self->decoder, "setstate", "(O)", saved_state); + _PyErr_ReplaceException(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; }