mirror of https://github.com/python/cpython
getbuffer(): release the buffer on error (if the buffer is not contiguous)
This commit is contained in:
parent
8bae4ec622
commit
21e09487ac
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue