From 7f91e8fad94dd34f83c6a124dbbe5d210be7715f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 29 Apr 2022 22:57:02 -0700 Subject: [PATCH] zink: Fix memory leak on error path. Fix defect reported by Coverity Scan. Resource leak (RESOURCE_LEAK) leaked_storage: Variable sampler_view going out of scope leaks the storage it points to. Fixes: 625457caafb ("zink: handle swapchain acquire failures more directly") Signed-off-by: Vinson Lee Acked-by: Mike Blumenkrantz Part-of: --- src/gallium/drivers/zink/zink_context.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index f9d8808..a611ea5 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -807,8 +807,10 @@ zink_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *pres, } if (zink_is_swapchain(res)) { - if (!zink_kopper_acquire(ctx, res, UINT64_MAX)) + if (!zink_kopper_acquire(ctx, res, UINT64_MAX)) { + FREE_CL(sampler_view); return NULL; + } } ivci = create_ivci(screen, res, &templ, state->target); -- 2.7.4