Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21e0948

Browse files
author
Victor Stinner
committed
getbuffer(): release the buffer on error (if the buffer is not contiguous)
1 parent 8bae4ec commit 21e0948

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Python/getargs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,7 @@ getbuffer(PyObject *arg, Py_buffer *view, char **errmsg)
13401340
return -1;
13411341
}
13421342
if (!PyBuffer_IsContiguous(view, 'C')) {
1343+
PyBuffer_Release(view);
13431344
*errmsg = "contiguous buffer";
13441345
return -1;
13451346
}

0 commit comments

Comments
 (0)