From 55cdde758c86fa97932ecc4fec1028bc0f5bfdaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Fri, 8 Mar 2024 15:35:37 +0100 Subject: [PATCH] zink: Use an intermediary variable for create_surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allows to NULL-check it afterwards. Signed-off-by: Corentin Noël Part-of: --- src/gallium/drivers/zink/zink_surface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_surface.c b/src/gallium/drivers/zink/zink_surface.c index dd80463497f..c64c068de0e 100644 --- a/src/gallium/drivers/zink/zink_surface.c +++ b/src/gallium/drivers/zink/zink_surface.c @@ -355,7 +355,8 @@ zink_create_surface(struct pipe_context *pctx, if (!transient) return NULL; ivci.image = transient->obj->image; - csurf->transient = wrap_surface(pctx, (struct pipe_surface*)create_surface(pctx, &transient->base.b, templ, &ivci, true)); + struct zink_surface *tsurf = create_surface(pctx, &transient->base.b, templ, &ivci, true); + csurf->transient = wrap_surface(pctx, &tsurf->base); if (!csurf->transient) { pipe_resource_reference((struct pipe_resource**)&transient, NULL); pipe_surface_release(pctx, &psurf);