Release buffer on error

Co-authored-by: Ondrej Baranovič <nulano@nulano.eu>
This commit is contained in:
Andrew Murray 2023-03-06 10:00:51 +11:00 committed by GitHub
parent b970eb9e5d
commit 494a3bcf2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -202,6 +202,7 @@ _frombytes(ImagingDisplayObject *display, PyObject *args) {
}
if (display->dib->ysize * display->dib->linesize != buffer.len) {
PyBuffer_Release(&buffer);
PyErr_SetString(PyExc_ValueError, "wrong size");
return NULL;
}