]> 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 06:58:41 +0000 (09:58 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 30 Mar 2015 06:58:41 +0000 (09:58 +0300)
Modules/_io/textio.c

index 3f01980af1511877645e0f8ac498788ee2bc92c0..d1c0d012328080d08279fde4d0c6306563465716 100644 (file)
@@ -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;
 }