From bff3ac0b267524dc9f0268fb83d045d06c461250 Mon Sep 17 00:00:00 2001 From: Heinrich Fink Date: Tue, 13 Jul 2021 11:12:56 +0200 Subject: [PATCH] gbm/dri: Fix leaking bo memory on failure path In gbm_dri_bo_create, when modifiers are requested but not supported, do not return NULL immediately, but first go to cleanup section to free already allocated buffer object. Fixes: cb9ae4273d68 ("dri: add loader_dri_create_image helper") Signed-off-by: Heinrich Fink Reviewed-by: Daniel Stone Reviewed-by: Simon Ser Part-of: --- src/gbm/backends/dri/gbm_dri.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 53a1d5b..96fa921 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -1196,7 +1196,7 @@ gbm_dri_bo_create(struct gbm_device *gbm, if (modifiers && (dri->image->base.version < 14 || !dri->image->createImageWithModifiers)) { errno = ENOSYS; - return NULL; + goto failed; } bo->image = loader_dri_create_image(dri->screen, dri->image, width, height, -- 2.7.4