[Python-checkins] cpython: Don't Py_DECREF NULL variable in io.IncrementalNewlineDecoder.

ross.lagerwall python-checkins at python.org
Sat Apr 7 07:12:21 CEST 2012


http://hg.python.org/cpython/rev/7657a229d513
changeset:   76149:7657a229d513
user:        Ross Lagerwall <rosslagerwall at gmail.com>
date:        Sat Apr 07 07:09:57 2012 +0200
summary:
  Don't Py_DECREF NULL variable in io.IncrementalNewlineDecoder.

Found with Clang's Static Analyzer.

files:
  Misc/NEWS            |  2 ++
  Modules/_io/textio.c |  2 +-
  2 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -19,6 +19,8 @@
 Library
 -------
 
+- Don't Py_DECREF NULL variable in io.IncrementalNewlineDecoder.
+
 - Issue #8515: Set __file__ when run file in IDLE.
   Initial patch by Bruce Frederiksen.
 
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -460,7 +460,7 @@
             output = PyUnicode_FromKindAndData(kind, translated, out);
             PyMem_Free(translated);
             if (!output)
-                goto error;
+                return NULL;
         }
         self->seennl |= seennl;
     }

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


More information about the Python-checkins mailing list