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

Will backport to 2.2.
This commit is contained in:
Martin v. Löwis 2003-09-07 20:42:29 +00:00
parent ee8f10fa37
commit 7bbcde70d1
1 changed files with 1 additions and 1 deletions

View File

@ -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)