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

christian.heimes python-checkins at python.org
Mon Sep 10 17:46:57 CEST 2012


http://hg.python.org/cpython/rev/71d94e79b0c3
changeset:   78969:71d94e79b0c3
parent:      78966:f9b95ffd24ce
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