[Python-checkins] cpython: Fixed reference leak in error branch of _bufferedreader_read_all(). The

georg.brandl python-checkins at python.org
Mon Sep 24 07:47:19 CEST 2012


http://hg.python.org/cpython/rev/b7c6dd1eaba2
changeset:   79127:b7c6dd1eaba2
user:        Christian Heimes <christian at cheimes.de>
date:        Mon Sep 10 17:46:09 2012 +0200
summary:
  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

files:
  Modules/_io/bufferedio.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -1499,8 +1499,10 @@
     }
 
     chunks = PyList_New(0);
-    if (chunks == NULL)
+    if (chunks == NULL) {
+        Py_XDECREF(data);
         return NULL;
+    }
 
     while (1) {
         if (data) {

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list