Kaydet (Commit) 7bbcde70 authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Only release buffer after file has been closed. Fixes #800824.

Will backport to 2.2.
üst ee8f10fa
......@@ -388,7 +388,6 @@ static PyObject *
file_close(PyFileObject *f)
{
int sts = 0;
PyMem_Free(f->f_setbuf);
if (f->f_fp != NULL) {
if (f->f_close != NULL) {
Py_BEGIN_ALLOW_THREADS
......@@ -398,6 +397,7 @@ file_close(PyFileObject *f)
}
f->f_fp = NULL;
}
PyMem_Free(f->f_setbuf);
if (sts == EOF)
return PyErr_SetFromErrno(PyExc_IOError);
if (sts != 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment