[Python-checkins] cpython (merge 3.4 -> default): Fixed reference leak in the "backslashreplace" error handler.

serhiy.storchaka python-checkins at python.org
Tue Sep 23 19:03:05 CEST 2014


https://hg.python.org/cpython/rev/e9e790ea071c
changeset:   92535:e9e790ea071c
parent:      92532:6dcc96fa3970
parent:      92534:80e0fc462005
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Sep 23 19:59:34 2014 +0300
summary:
  Fixed reference leak in the "backslashreplace" error handler.

files:
  Python/codecs.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Python/codecs.c b/Python/codecs.c
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -890,8 +890,10 @@
                 ressize += 1+1+2;
         }
         res = PyUnicode_New(ressize, 127);
-        if (res==NULL)
+        if (res == NULL) {
+            Py_DECREF(object);
             return NULL;
+        }
         for (i = start, outp = PyUnicode_1BYTE_DATA(res);
             i < end; ++i) {
             c = PyUnicode_READ_CHAR(object, i);

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


More information about the Python-checkins mailing list