lavapipe: Fix lvp_pipeline_compile's nir_xfb_info leak.

v2: Cleanup, as suggested by Mike Blumenkrantz.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10688>
This commit is contained in:
Jose Fonseca
2021-05-07 11:53:28 +01:00
parent c1609c3531
commit 24043d215f

View File

@@ -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);
}
}