From bd3e50545339ffd4f258437d6282e2cfbf113725 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 6 Mar 2020 15:57:40 +0200 Subject: [PATCH] iris: properly free resources on BO allocation failure Signed-off-by: Lionel Landwerlin Cc: Reviewed-by: Adam Jackson Reviewed-by: Rafael Antognolli Part-of: --- src/gallium/drivers/iris/iris_resource.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 8a3a9a87f7a..50f01d350cf 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -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; -- 2.30.2