[Python-checkins] cpython (3.5): Fix PyUnicode_FromFormatV() error handling

victor.stinner python-checkins at python.org
Wed Sep 21 08:20:01 EDT 2016


https://hg.python.org/cpython/rev/00f090563f1b
changeset:   103984:00f090563f1b
branch:      3.5
parent:      103979:06efc625578a
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Sep 21 14:13:14 2016 +0200
summary:
  Fix PyUnicode_FromFormatV() error handling

Issue #28233: Fix a memory leak if the format string contains a non-ASCII
character, destroy the unicode writer.

files:
  Objects/unicodeobject.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -2719,7 +2719,7 @@
                         "PyUnicode_FromFormatV() expects an ASCII-encoded format "
                         "string, got a non-ASCII byte: 0x%02x",
                         (unsigned char)*p);
-                    return NULL;
+                    goto fail;
                 }
                 p++;
             }

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


More information about the Python-checkins mailing list