[Python-checkins] [2.7] bpo-36289: Fix a possible reference leak in the io module (GH-12329)
Victor Stinner
webhook-mailer at python.org
Thu Mar 14 11:35:45 EDT 2019
https://github.com/python/cpython/commit/2dd6e079ae71f3723fbea2582ac080be06a6968f
commit: 2dd6e079ae71f3723fbea2582ac080be06a6968f
branch: 2.7
author: stratakis <cstratak at redhat.com>
committer: Victor Stinner <vstinner at redhat.com>
date: 2019-03-14T16:35:40+01:00
summary:
[2.7] bpo-36289: Fix a possible reference leak in the io module (GH-12329)
Fix a reference leak in _bufferedreader_read_all():
_io.BufferedIOMixin.read() leaks a reference on 'data'
when it reads the whole file content but flush() fails.
files:
A Misc/NEWS.d/next/Library/2019-03-14-15-42-48.bpo-36289.wYKS47.rst
M Modules/_io/bufferedio.c
diff --git a/Misc/NEWS.d/next/Library/2019-03-14-15-42-48.bpo-36289.wYKS47.rst b/Misc/NEWS.d/next/Library/2019-03-14-15-42-48.bpo-36289.wYKS47.rst
new file mode 100644
index 000000000000..8917bee727bf
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-03-14-15-42-48.bpo-36289.wYKS47.rst
@@ -0,0 +1 @@
+Fix a possible reference leak in the io module.
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index b8c98a4d0d04..d68f7d85b029 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -1363,6 +1363,7 @@ _bufferedreader_read_all(buffered *self)
res = buffered_flush_and_rewind_unlocked(self);
if (res == NULL) {
Py_DECREF(chunks);
+ Py_XDECREF(data);
return NULL;
}
Py_CLEAR(res);
More information about the Python-checkins
mailing list