mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
Fix #3651 various memory leaks when using the buffer interface
by Amaury Forgeot d'Arc Reviewer: Antoine Pitrou
This commit is contained in:
parent
4b24a42f3c
commit
9edd2bd35c
5 changed files with 22 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue