[Python-checkins] cpython (3.2): Issue #15868: Fix refleak in bytesio.c (Coverity #715365).

stefan.krah python-checkins at python.org
Sat Sep 8 11:26:34 CEST 2012


http://hg.python.org/cpython/rev/df663603e67a
changeset:   78876:df663603e67a
branch:      3.2
parent:      78873:2e8b01583839
user:        Stefan Krah <skrah at bytereef.org>
date:        Sat Sep 08 11:12:33 2012 +0200
summary:
  Issue #15868: Fix refleak in bytesio.c (Coverity #715365).

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


diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -692,8 +692,10 @@
     }
     else {
         dict = PyDict_Copy(self->dict);
-        if (dict == NULL)
+        if (dict == NULL) {
+            Py_DECREF(initvalue);
             return NULL;
+        }
     }
 
     state = Py_BuildValue("(OnN)", initvalue, self->pos, dict);

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


More information about the Python-checkins mailing list