From 24043d215f634b25562776cb3387b91506bcee06 Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Fri, 7 May 2021 11:53:28 +0100 Subject: [PATCH] lavapipe: Fix lvp_pipeline_compile's nir_xfb_info leak. v2: Cleanup, as suggested by Mike Blumenkrantz. Reviewed-By: Mike Blumenkrantz Part-of: --- src/gallium/frontends/lavapipe/lvp_pipeline.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c index 333cbd67add..7943199dd32 100644 --- a/src/gallium/frontends/lavapipe/lvp_pipeline.c +++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c @@ -701,11 +701,10 @@ lvp_pipeline_compile(struct lvp_pipeline *pipeline, struct pipe_shader_state shstate = {0}; fill_shader_prog(&shstate, stage, pipeline); - nir_xfb_info *xfb_info = NULL; if (stage == MESA_SHADER_VERTEX || stage == MESA_SHADER_GEOMETRY || stage == MESA_SHADER_TESS_EVAL) { - xfb_info = nir_gather_xfb_info(pipeline->pipeline_nir[stage], NULL); + nir_xfb_info *xfb_info = nir_gather_xfb_info(pipeline->pipeline_nir[stage], NULL); if (xfb_info) { uint8_t output_mapping[VARYING_SLOT_TESS_MAX]; memset(output_mapping, 0, sizeof(output_mapping)); @@ -731,6 +730,8 @@ lvp_pipeline_compile(struct lvp_pipeline *pipeline, shstate.stream_output.output[i].start_component = ffs(xfb_info->outputs[i].component_mask) - 1; shstate.stream_output.output[i].stream = xfb_info->buffer_to_stream[xfb_info->outputs[i].buffer]; } + + ralloc_free(xfb_info); } }