From: Christian Heimes Date: Mon, 10 Sep 2012 00:51:27 +0000 (+0200) Subject: Fixed resource leak to scratch when _PyUnicodeWriter_Prepare fails X-Git-Tag: v3.3.1rc1~818^2^2~113 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=110ac16b9f1be086ba98aa6f1ef8d7105493d92e;p=python Fixed resource leak to scratch when _PyUnicodeWriter_Prepare fails --- diff --git a/Objects/longobject.c b/Objects/longobject.c index 80fe724d34..7e12b34884 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -1628,8 +1628,10 @@ long_to_decimal_string_internal(PyObject *aa, 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; }