diff options
author | Georg Brandl <georg@python.org> | 2009-07-22 11:57:15 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-07-22 11:57:15 (GMT) |
commit | ec812caf5dd4c8e49c24341852181cca1740277e (patch) | |
tree | 78787b408a873de22de418837dc471dee818b0ae /Objects/bytearrayobject.c | |
parent | af2406f21598c136980cebac6e7e9ecdc353ded6 (diff) | |
download | cpython-ec812caf5dd4c8e49c24341852181cca1740277e.zip cpython-ec812caf5dd4c8e49c24341852181cca1740277e.tar.gz cpython-ec812caf5dd4c8e49c24341852181cca1740277e.tar.bz2 |
Issue #6540: Fixed crash for bytearray.translate() with invalid parameters.
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r-- | Objects/bytearrayobject.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 5591847..27b41bb 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -1465,15 +1465,17 @@ bytearray_translate(PyByteArrayObject *self, PyObject *args) if (vtable.len != 256) { PyErr_SetString(PyExc_ValueError, "translation table must be 256 characters long"); - goto done; + PyBuffer_Release(&vtable); + return NULL; } table = (const char*)vtable.buf; } if (delobj != NULL) { if (_getbuffer(delobj, &vdel) < 0) { - delobj = NULL; /* don't try to release vdel buffer on exit */ - goto done; + if (tableobj != NULL) + PyBuffer_Release(&vtable); + return NULL; } } else { |