Fix #3651 various memory leaks when using the buffer interface
by Amaury Forgeot d'Arc
Reviewer: Antoine Pitrou
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 @@
*/
if ( this_ch < ' ' || this_ch > (' ' + 64)) {
PyErr_SetString(Error, "Illegal char");
+ PyBuffer_Release(&pascii);
Py_DECREF(rv);
return NULL;
}
@@ -259,6 +260,7 @@
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 @@
** 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;
}