summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-07-22 12:03:59 (GMT)
committerGeorg Brandl <georg@python.org>2009-07-22 12:03:59 (GMT)
commit953152f0640d7c99b9ffe03392a4c9ce590489cb (patch)
treefd4a8d794c249b3a96846d8427e8df0ca4bb0862 /Objects
parent2f19bb1447ace998a375c96708a34058c2b4ffff (diff)
downloadcpython-953152f0640d7c99b9ffe03392a4c9ce590489cb.zip
cpython-953152f0640d7c99b9ffe03392a4c9ce590489cb.tar.gz
cpython-953152f0640d7c99b9ffe03392a4c9ce590489cb.tar.bz2
Merged revisions 74167 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74167 | georg.brandl | 2009-07-22 13:57:15 +0200 (Mi, 22 Jul 2009) | 1 line Issue #6540: Fixed crash for bytearray.translate() with invalid parameters. ........
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bytearrayobject.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 165fd10..f3d5697 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -1389,15 +1389,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 {