Module: Mesa
Branch: staging/21.1
Commit: d050deb6762fc934f2ce4db880a33b8856fe2417
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d050deb6762fc934f2ce4db880a33b8856fe2417

Author: Juan A. Suarez Romero <jasua...@igalia.com>
Date:   Fri Apr 30 12:49:59 2021 +0200

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 <ito...@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasua...@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10643>
(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 7536cb27903..940a3ebd602 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);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to