From 5d85966805df93e11669b21df1cbdeb3dcb2e565 Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Mon, 27 Mar 2023 11:45:12 +0200 Subject: [PATCH] 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: 96ba0344db8f ("intel: Use common helpers for TCS passthrough shaders") Signed-off-by: Patrick Lerda Reviewed-by: Emma Anholt Part-of: --- src/intel/compiler/brw_nir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index 99c0fe54e59..0dbefc288d4 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -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");