From 6c7916b7f665db7f5af929ed0f64206d70fccc56 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 27 Apr 2022 01:35:02 -0700 Subject: [PATCH] crocus: Fix memory leaks on iris_resource_create failure paths We've already allocated the pipe resource, so we ought to free it before returning. Fixes: d8a38edc48e ("crocus: fail resource allocation properly.") Fixes: f3630548f1d ("crocus: initial gallium driver for Intel gfx 4-7") Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/crocus/crocus_resource.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/crocus/crocus_resource.c b/src/gallium/drivers/crocus/crocus_resource.c index 3265483..8effdb2 100644 --- a/src/gallium/drivers/crocus/crocus_resource.c +++ b/src/gallium/drivers/crocus/crocus_resource.c @@ -695,12 +695,12 @@ crocus_resource_create_with_modifiers(struct pipe_screen *pscreen, if (templ->usage == PIPE_USAGE_STAGING && templ->bind == PIPE_BIND_DEPTH_STENCIL && devinfo->ver < 6) - return NULL; + goto fail; const bool isl_surf_created_successfully = crocus_resource_configure_main(screen, res, templ, modifier, 0); if (!isl_surf_created_successfully) - return NULL; + goto fail; const char *name = "miptree"; -- 2.7.4