iris: Free resource if failed to allocate surface state
authorSagar Ghuge <sagar.ghuge@intel.com>
Wed, 7 Aug 2019 21:00:14 +0000 (14:00 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 20 Aug 2019 07:50:55 +0000 (00:50 -0700)
Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/drivers/iris/iris_state.c

index b8c2871698cdff0d9a91aaf798401bebb7f413ee..98fe87c7f0681de4a7ef974ecf45383e901737aa 100644 (file)
@@ -2035,8 +2035,10 @@ iris_create_surface(struct pipe_context *ctx,
    void *map = alloc_surface_states(ice->state.surface_uploader,
                                     &surf->surface_state,
                                     res->aux.possible_usages);
-   if (!unlikely(map))
+   if (!unlikely(map)) {
+      pipe_resource_reference(&surf->surface_state.res, NULL);
       return NULL;
+   }
 
 #if GEN_GEN == 8
    void *map_read = alloc_surface_states(ice->state.surface_uploader,