summaryrefslogtreecommitdiffstats
path: root/Modules/_io
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2012-10-04 10:37:56 (GMT)
committerJesus Cea <jcea@jcea.es>2012-10-04 10:37:56 (GMT)
commitdc469454ec997166aea062f5727a8d59bab2f7a0 (patch)
treed8f0d7ff0a05298ad7c79314eab6e06e964099a6 /Modules/_io
parent279ed3cc55e786c96c11aa9f224c507de5024099 (diff)
downloadcpython-dc469454ec997166aea062f5727a8d59bab2f7a0.zip
cpython-dc469454ec997166aea062f5727a8d59bab2f7a0.tar.gz
cpython-dc469454ec997166aea062f5727a8d59bab2f7a0.tar.bz2
Closes #15488: Closed files keep their buffer alive
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/bufferedio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index 334734b..432349a 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -519,6 +519,11 @@ buffered_close(buffered *self, PyObject *args)
res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_close, NULL);
+ if (self->buffer) {
+ PyMem_Free(self->buffer);
+ self->buffer = NULL;
+ }
+
end:
LEAVE_BUFFERED(self)
return res;