diff options
author | Christian Heimes <christian@cheimes.de> | 2012-09-10 00:51:27 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2012-09-10 00:51:27 (GMT) |
commit | 110ac16b9f1be086ba98aa6f1ef8d7105493d92e (patch) | |
tree | 3553a5150e16604bdedda9c596c39513eaf9fb18 /Objects | |
parent | f03572d040f0f34b7fd3c1bcbd232d60b5a00d78 (diff) | |
download | cpython-110ac16b9f1be086ba98aa6f1ef8d7105493d92e.zip cpython-110ac16b9f1be086ba98aa6f1ef8d7105493d92e.tar.gz cpython-110ac16b9f1be086ba98aa6f1ef8d7105493d92e.tar.bz2 |
Fixed resource leak to scratch when _PyUnicodeWriter_Prepare fails
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/longobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index 80fe724..7e12b34 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; } |