summaryrefslogtreecommitdiffstats
path: root/Modules/binascii.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-27 00:31:37 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-27 00:31:37 (GMT)
commit9edd2bd35cfc5f33b53c5def02cac23e7bb6e84b (patch)
tree4ccbdce39b24128ed28c1979cb07eaf361f0ae62 /Modules/binascii.c
parent4b24a42f3c72b4f88da8989a77a175e654dbdcbb (diff)
downloadcpython-9edd2bd35cfc5f33b53c5def02cac23e7bb6e84b.zip
cpython-9edd2bd35cfc5f33b53c5def02cac23e7bb6e84b.tar.gz
cpython-9edd2bd35cfc5f33b53c5def02cac23e7bb6e84b.tar.bz2
Fix #3651 various memory leaks when using the buffer interface
by Amaury Forgeot d'Arc Reviewer: Antoine Pitrou
Diffstat (limited to 'Modules/binascii.c')
-rw-r--r--Modules/binascii.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/binascii.c b/Modules/binascii.c
index 82c1423..c6e0362 100644
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -231,6 +231,7 @@ binascii_a2b_uu(PyObject *self, PyObject *args)
*/
if ( this_ch < ' ' || this_ch > (' ' + 64)) {
PyErr_SetString(Error, "Illegal char");
+ PyBuffer_Release(&pascii);
Py_DECREF(rv);
return NULL;
}
@@ -259,6 +260,7 @@ binascii_a2b_uu(PyObject *self, PyObject *args)
if ( this_ch != ' ' && this_ch != ' '+64 &&
this_ch != '\n' && this_ch != '\r' ) {
PyErr_SetString(Error, "Trailing garbage");
+ PyBuffer_Release(&pascii);
Py_DECREF(rv);
return NULL;
}
@@ -805,6 +807,7 @@ binascii_rledecode_hqx(PyObject *self, PyObject *args)
** of the string only). This is a programmer error.
*/
PyErr_SetString(Error, "Orphaned RLE code at start");
+ PyBuffer_Release(&pin);
Py_DECREF(rv);
return NULL;
}