From 4c53777876246e60f3b56c043be877974c26b30e Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sat, 12 Sep 2020 16:03:06 +0200 Subject: [PATCH] image_surface_create_for_data: fix a potential leak --- cairo/surface.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cairo/surface.c b/cairo/surface.c index 99f90e1e..ae7e69e7 100644 --- a/cairo/surface.c +++ b/cairo/surface.c @@ -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);