Mesa (staging/20.0): iris: properly free resources on BO allocation failure

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 13 17:27:32 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: 4bf1d033a6c2d0db3b5564ef52581d62cbe13b34
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4bf1d033a6c2d0db3b5564ef52581d62cbe13b34

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Fri Mar  6 15:57:40 2020 +0200

iris: properly free resources on BO allocation failure

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: <mesa-stable at lists.freedesktop.org>
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4086>
(cherry picked from commit bd3e50545339ffd4f258437d6282e2cfbf113725)

---

 .pick_status.json                        | 2 +-
 src/gallium/drivers/iris/iris_resource.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 027f3ff0b6c..325468dd377 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -184,7 +184,7 @@
         "description": "iris: properly free resources on BO allocation failure",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index 7ca6097840a..03ef4353c6b 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -946,7 +946,7 @@ iris_resource_from_user_memory(struct pipe_screen *pscreen,
                                     user_memory, templ->width0,
                                     IRIS_MEMZONE_OTHER);
    if (!res->bo) {
-      free(res);
+      iris_resource_destroy(pscreen, &res->base);
       return NULL;
    }
 
@@ -989,7 +989,7 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
       unreachable("invalid winsys handle type");
    }
    if (!res->bo)
-      return NULL;
+      goto fail;
 
    res->offset = whandle->offset;
 



More information about the mesa-commit mailing list