Skip to content

glsl: fix gl_nir_validate_intrastage_interface_blocks() memory leak

What does this MR do and why?

glsl: fix gl_nir_validate_intrastage_interface_blocks() memory leak

For instance, this issue is triggered on redeonsi with
"piglit/bin/shader_runner tests/spec/glsl-1.50/linker/interface-blocks-multiple-vs-member-count-mismatch.shader_test -auto -fbo":
Indirect leak of 176 byte(s) in 1 object(s) allocated from:
    #0 0x7f894b5cd7ef in __interceptor_malloc (/usr/lib64/libasan.so.6+0xb17ef)
    #1 0x7f894183aebf in ralloc_size ../src/util/ralloc.c:118
    #2 0x7f894183b36e in rzalloc_size ../src/util/ralloc.c:152
    #3 0x7f894183b36e in rzalloc_array_size ../src/util/ralloc.c:232
    #4 0x7f894182da67 in _mesa_hash_table_init ../src/util/hash_table.c:163
    #5 0x7f894182da67 in _mesa_hash_table_create ../src/util/hash_table.c:186
    #6 0x7f894169af03 in gl_nir_validate_intrastage_interface_blocks ../src/compiler/glsl/gl_nir_link_interface_blocks.c:533
    #7 0x7f89414464a4 in link_intrastage_shaders ../src/compiler/glsl/gl_nir_linker.c:2750
    #8 0x7f894144bad2 in gl_nir_link_glsl ../src/compiler/glsl/gl_nir_linker.c:3785
    #9 0x7f894128977e in st_link_glsl_to_nir ../src/mesa/state_tracker/st_glsl_to_nir.cpp:515
    #10 0x7f894128977e in st_link_shader ../src/mesa/state_tracker/st_glsl_to_nir.cpp:1008
    #11 0x7f894113c7b5 in link_program ../src/mesa/main/shaderapi.c:1317
    #12 0x7f894113c7b5 in link_program_error ../src/mesa/main/shaderapi.c:1426
    #13 0x7f8940afb1bb in _mesa_unmarshal_LinkProgram src/mapi/glapi/gen/marshal_generated2.c:1627
    #14 0x7f894063319b in glthread_unmarshal_batch ../src/mesa/main/glthread.c:141
    #15 0x7f894184e658 in util_queue_thread_func ../src/util/u_queue.c:294
    #16 0x7f89418d220a in impl_thrd_routine ../src/c11/impl/threads_posix.c:67
    #17 0x7f894a66a7c3  (/lib64/libc.so.6+0x867c3)
...
SUMMARY: AddressSanitizer: 1392 byte(s) leaked in 11 allocation(s).

Fixes: ffbd763586f5 ("glsl: add gl_nir_validate_intrastage_interface_blocks()")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>

Merge request reports

Loading