summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-09-10 00:51:27 (GMT)
committerChristian Heimes <christian@cheimes.de>2012-09-10 00:51:27 (GMT)
commit110ac16b9f1be086ba98aa6f1ef8d7105493d92e (patch)
tree3553a5150e16604bdedda9c596c39513eaf9fb18 /Objects
parentf03572d040f0f34b7fd3c1bcbd232d60b5a00d78 (diff)
downloadcpython-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.c4
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;
}