From 2ef356c0c7980f29788d8e4e08989c111851229d Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Fri, 30 Apr 2021 12:49:59 +0200 Subject: [PATCH] v3d: fix resource leak in error path Do not leak pipe resource if scanout resource creation fails. Fixes: bf6973199d1 ("v3d: Allow the UIF modifier with renderonly.") Reviewed-by: Iago Toral Quiroga Signed-off-by: Juan A. Suarez Romero Part-of: (cherry picked from commit 66bf683ca9b5889aa05c32d3e35ea2649bab7d23) --- .pick_status.json | 2 +- src/gallium/drivers/v3d/v3d_resource.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index df7816590e6..aaf075639e6 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -166,7 +166,7 @@ "description": "v3d: fix resource leak in error path", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "bf6973199d186c93da35becc695db58fd3d1b4e5" }, diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c index acfcf6f320c..602ba6d8447 100644 --- a/src/gallium/drivers/v3d/v3d_resource.c +++ b/src/gallium/drivers/v3d/v3d_resource.c @@ -808,7 +808,7 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen, if (!rsc->scanout) { fprintf(stderr, "Failed to create scanout resource\n"); - return NULL; + goto fail; } assert(handle.type == WINSYS_HANDLE_TYPE_FD); rsc->bo = v3d_bo_open_dmabuf(screen, handle.handle);