iris: properly free resources on BO allocation failure
[mesa.git] / 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;