]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances.
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 30 Mar 2015 07:00:49 +0000 (10:00 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 30 Mar 2015 07:00:49 +0000 (10:00 +0300)
Modules/_io/textio.c

index 65c8d8d4e893511a7a394617fece06cbcf901b98..8ac8a4acdea6e0eae598e92a88d4bfebf6a97b78 100644 (file)
@@ -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;
 }