intel: fix memory leak related to brw_nir_create_passthrough_tcs()

Indeed, the parameter "mem_ctx" was not processed.

For instance, this issue is triggered with the crocus driver and
"piglit/bin/shader_runner tests/spec/arb_tessellation_shader/execution/compatibility/tes-clip-vertex-different-from-position.shader_test -auto -fbo":
SUMMARY: AddressSanitizer: 235216 byte(s) leaked in 48 allocation(s).

Fixes: 96ba0344db ("intel: Use common helpers for TCS passthrough shaders")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22173>
This commit is contained in:
Patrick Lerda
2023-03-27 11:45:12 +02:00
committed by Marge Bot
parent 9c90deefb2
commit 5d85966805

View File

@@ -1974,6 +1974,9 @@ brw_nir_create_passthrough_tcs(void *mem_ctx, const struct brw_compiler *compile
nir_shader *nir =
nir_create_passthrough_tcs_impl(options, locations, num_locations,
key->input_vertices);
ralloc_steal(mem_ctx, nir);
nir->info.inputs_read = inputs_read;
nir->info.tess._primitive_mode = key->_tes_primitive_mode;
nir_validate_shader(nir, "in brw_nir_create_passthrough_tcs");