diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-09-07 20:42:29 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-09-07 20:42:29 (GMT) |
commit | 7bbcde70d1c5e140e8ac6bc12506e0156f910d0e (patch) | |
tree | 2330b2005971b2a693b14928cb5787591f8f4ad7 | |
parent | ee8f10fa37335cbbb8830c200edefd91605c22ac (diff) | |
download | cpython-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.
-rw-r--r-- | Objects/fileobject.c | 2 |
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) |