Skip to content

Commit

Permalink
image_surface_create_for_data: fix a potential leak
Browse files Browse the repository at this point in the history
  • Loading branch information
lazka committed Sep 12, 2020
1 parent 8d0b05c commit 4c53777
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cairo/surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,10 @@ image_surface_create_for_data (PyTypeObject *type, PyObject *args) {
}

res = PyObject_GetBuffer (obj, view, PyBUF_WRITABLE);
if (res == -1)
if (res == -1) {
PyMem_Free (view);
return NULL;
}

if (height * stride > view->len) {
PyBuffer_Release (view);
Expand Down

0 comments on commit 4c53777

Please sign in to comment.