From 8dcc2623114e28d497f995ccb89429f4002b18cb Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Tue, 22 Jul 2025 23:30:18 -0700 Subject: [PATCH] lavapipe: fix a leak on a lvp_image_create exit path This traces back to c688f8f8c5c3d3d3e1fe3f84679f972d7f8ead30, but the shape of the fix would be different if against that. So we do the optimal for the current code flow and only port to stable. Cc: mesa-stable Reviewed-by: Lucas Fryzek Part-of: (cherry picked from commit 16e3293c31d2357785c1f592a56ac9ca9bc714d9) --- .pick_status.json | 2 +- src/gallium/frontends/lavapipe/lvp_image.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 9eb866955ca..dd7377c0b4c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2064,7 +2064,7 @@ "description": "lavapipe: fix a leak on a lvp_image_create exit path", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/frontends/lavapipe/lvp_image.c b/src/gallium/frontends/lavapipe/lvp_image.c index 5cf6aff111f..0878410ca7b 100644 --- a/src/gallium/frontends/lavapipe/lvp_image.c +++ b/src/gallium/frontends/lavapipe/lvp_image.c @@ -184,8 +184,10 @@ lvp_image_create(VkDevice _device, &template, &image->planes[p].size); } - if (!image->planes[p].bo) - return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY); + if (!image->planes[p].bo) { + result = vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY); + goto fail; + } image->planes[p].size = align64(image->planes[p].size, image->alignment);