iris: properly free resources on BO allocation failure
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 6 Mar 2020 13:57:40 +0000 (15:57 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sat, 11 Apr 2020 19:04:22 +0000 (22:04 +0300)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4086>

src/gallium/drivers/iris/iris_resource.c

index 8a3a9a87f7a1f7d3c3002aab8783e8124059b56c..50f01d350cfc54eaba0ac063d7fb0afebc4ba59d 100644 (file)
@@ -973,7 +973,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;
    }
 
@@ -1016,7 +1016,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;