]> granicus.if.org Git - python/commitdiff
Fix PyUnicode_FromFormatV() error handling
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 21 Sep 2016 12:13:14 +0000 (14:13 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 21 Sep 2016 12:13:14 +0000 (14:13 +0200)
Issue #28233: Fix a memory leak if the format string contains a non-ASCII
character, destroy the unicode writer.

Objects/unicodeobject.c

index af045646c84a508f9186a85db6516a8fc0ac9f18..176ec13616c2d729152b204db3afc1733486ceb8 100644 (file)
@@ -2719,7 +2719,7 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
                         "PyUnicode_FromFormatV() expects an ASCII-encoded format "
                         "string, got a non-ASCII byte: 0x%02x",
                         (unsigned char)*p);
-                    return NULL;
+                    goto fail;
                 }
                 p++;
             }