Mesa (staging/21.1): v3d: fix resource leak in error path

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun May 16 20:14:04 UTC 2021


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

Author: Juan A. Suarez Romero <jasuarez at 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 <itoral at igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez at 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 3655bb8a6a8..4c46b8e18b5 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);



More information about the mesa-commit mailing list