Commits

Christian Heimes committed 1349e95 Draft

Fixed resource leak to scratch when _PyUnicodeWriter_Prepare fails

Comments (0)

Files changed (1)

Objects/longobject.c

         strlen++;
     }
     if (writer) {
-        if (_PyUnicodeWriter_Prepare(writer, strlen, '9') == -1)
+        if (_PyUnicodeWriter_Prepare(writer, strlen, '9') == -1) {
+            Py_DECREF(scratch);
             return -1;
+        }
         kind = writer->kind;
         str = NULL;
     }