mesa/program: fix memory leak triggered by multiple targets used on one texture image...
authorPatrick Lerda <patrick9876@free.fr>
Tue, 28 Feb 2023 17:38:56 +0000 (18:38 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 7 Mar 2023 23:11:29 +0000 (23:11 +0000)
commita692fe418ed0b2c6534d170d3e8adbfeab466e6b
tree95430cdd8c24648f083022a397f4db134036fb22
parent444250a5e79180e96cf1c8c2716d35a6cde185c9
mesa/program: fix memory leak triggered by multiple targets used on one texture image unit

For instance, with "piglit-2000/bin/asmparsertest ARBfp1.0 tests/asmparsertest/shaders/ARBfp1.0/shadow-02.txt":
Direct leak of 192 byte(s) in 2 object(s) allocated from:
    #0 0x7f6e8378f987 in calloc (/usr/lib64/libasan.so.6+0xb1987)
    #1 0x7f6e7769d620 in asm_instruction_copy_ctor ../src/mesa/program/program_parse.y:2146
    #2 0x7f6e7769d620 in yyparse ../src/mesa/program/program_parse.y:439
    #3 0x7f6e776a6725 in _mesa_parse_arb_program ../src/mesa/program/program_parse.y:2590
    #4 0x7f6e77687f69 in _mesa_parse_arb_fragment_program ../src/mesa/program/arbprogparse.c:82
    #5 0x7f6e77630765 in set_program_string ../src/mesa/main/arbprogram.c:402
    #6 0x7f6e76ec3e8a in _mesa_unmarshal_ProgramStringARB src/mapi/glapi/gen/marshal_generated2.c:4152
    #7 0x7f6e76a0e585 in glthread_unmarshal_batch ../src/mesa/main/glthread.c:122
    #8 0x7f6e76a1031d in _mesa_glthread_finish ../src/mesa/main/glthread.c:383
    #9 0x7f6e76a1031d in _mesa_glthread_finish ../src/mesa/main/glthread.c:348
    #10 0x7f6e76e6a062 in _mesa_marshal_GetError src/mapi/glapi/gen/marshal_generated1.c:1809

Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21728>
src/mesa/program/program_parse.y