getbuffer(): release the buffer on error (if the buffer is not contiguous)

This commit is contained in:
Victor Stinner 2010-06-24 22:57:10 +00:00
parent 8bae4ec622
commit 21e09487ac
1 changed files with 1 additions and 0 deletions

View File

@ -1340,6 +1340,7 @@ getbuffer(PyObject *arg, Py_buffer *view, char **errmsg)
return -1;
}
if (!PyBuffer_IsContiguous(view, 'C')) {
PyBuffer_Release(view);
*errmsg = "contiguous buffer";
return -1;
}