From 57ce422e20f10b87ca3872dcca75604a7cf75211 Mon Sep 17 00:00:00 2001 From: Sagar Ghuge Date: Wed, 7 Aug 2019 14:00:14 -0700 Subject: [PATCH] iris: Free resource if failed to allocate surface state Signed-off-by: Sagar Ghuge Reviewed-by: Kenneth Graunke --- src/gallium/drivers/iris/iris_state.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index b8c2871698c..98fe87c7f06 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -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, -- 2.30.2