summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-09-10 15:46:09 (GMT)
committerChristian Heimes <christian@cheimes.de>2012-09-10 15:46:09 (GMT)
commitf47d79fec1b6cbb0d38b9a828cf94202c21e50f8 (patch)
tree47e3e0b91358bc409df40189eeeb27fa768b531c
parent76c082911b69c5f3bb2bee9aadef0a0ea9162eac (diff)
downloadcpython-f47d79fec1b6cbb0d38b9a828cf94202c21e50f8.zip
cpython-f47d79fec1b6cbb0d38b9a828cf94202c21e50f8.tar.gz
cpython-f47d79fec1b6cbb0d38b9a828cf94202c21e50f8.tar.bz2
Fixed reference leak in error branch of _bufferedreader_read_all(). The variable data can contain a bytes object but it wasn't cleaned up when PyList_New() failed. CID 715364
-rw-r--r--Modules/_io/bufferedio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index 67b7cc4..334734b 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -1499,8 +1499,10 @@ _bufferedreader_read_all(buffered *self)
}
chunks = PyList_New(0);
- if (chunks == NULL)
+ if (chunks == NULL) {
+ Py_XDECREF(data);
return NULL;
+ }
while (1) {
if (data) {