Skip to content

Commit a692fe4

Browse files
Patrick LerdaMarge Bot
authored andcommitted
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>
1 parent 444250a commit a692fe4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/mesa/program/program_parse.y

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ SAMPLE_instruction: SAMPLE_OP maskedDstReg ',' swizzleSrcReg ',' texImageUnit ',
468468
!= shadow_tex))) {
469469
yyerror(& @8, state,
470470
"multiple targets used on one texture image unit");
471+
free($$);
471472
YYERROR;
472473
}
473474

@@ -519,6 +520,7 @@ TXD_instruction: TXD_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg ',' swi
519520
!= shadow_tex))) {
520521
yyerror(& @12, state,
521522
"multiple targets used on one texture image unit");
523+
free($$);
522524
YYERROR;
523525
}
524526

0 commit comments

Comments
 (0)