summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-09-07 20:42:29 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-09-07 20:42:29 (GMT)
commit7bbcde70d1c5e140e8ac6bc12506e0156f910d0e (patch)
tree2330b2005971b2a693b14928cb5787591f8f4ad7 /Objects/fileobject.c
parentee8f10fa37335cbbb8830c200edefd91605c22ac (diff)
downloadcpython-7bbcde70d1c5e140e8ac6bc12506e0156f910d0e.zip
cpython-7bbcde70d1c5e140e8ac6bc12506e0156f910d0e.tar.gz
cpython-7bbcde70d1c5e140e8ac6bc12506e0156f910d0e.tar.bz2
Only release buffer after file has been closed. Fixes #800824.
Will backport to 2.2.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index cdcacc4..d7c9da5 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -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)