diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-04-01 22:48:11 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-04-01 22:48:11 (GMT) |
commit | 29f843816bb6016ac673a3e0e4b3996fd235a152 (patch) | |
tree | fcd4316b1ab918c4bb37a4736f86f85f764f6a74 /Objects | |
parent | ab3c1c1994ec819781ba27ba8a5c6d75f70cb2af (diff) | |
parent | 709176f10c1774f608a318171a94371e7d05d98f (diff) | |
download | cpython-29f843816bb6016ac673a3e0e4b3996fd235a152.zip cpython-29f843816bb6016ac673a3e0e4b3996fd235a152.tar.gz cpython-29f843816bb6016ac673a3e0e4b3996fd235a152.tar.bz2 |
merge heads
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytearrayobject.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 4202ff2..55b4df6 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -2234,8 +2234,10 @@ bytearray_extend(PyByteArrayObject *self, PyObject *arg) } bytearray_obj = PyByteArray_FromStringAndSize(NULL, buf_size); - if (bytearray_obj == NULL) + if (bytearray_obj == NULL) { + Py_DECREF(it); return NULL; + } buf = PyByteArray_AS_STRING(bytearray_obj); while ((item = PyIter_Next(it)) != NULL) { @@ -2268,8 +2270,10 @@ bytearray_extend(PyByteArrayObject *self, PyObject *arg) return NULL; } - if (bytearray_setslice(self, Py_SIZE(self), Py_SIZE(self), bytearray_obj) == -1) + if (bytearray_setslice(self, Py_SIZE(self), Py_SIZE(self), bytearray_obj) == -1) { + Py_DECREF(bytearray_obj); return NULL; + } Py_DECREF(bytearray_obj); Py_RETURN_NONE; |