Skip to content

Commit ff7446b

Browse files
Patrick LerdaMarge Bot
Patrick Lerda
authored and
Marge Bot
committed
mesa/program: fix memory leak triggered by arb alias
The function _mesa_symbol_table_add_symbol() copies the string with strdup(), the original string should be freed. For instance, with "piglit/fp-fragment-position -auto -fbo": Direct leak of 7 byte(s) in 1 object(s) allocated from: #0 0xffff99c59050 in __interceptor_strdup (/usr/lib64/libasan.so.6+0x59050) #1 0xffff8f53d24c in handle_ident ../src/mesa/program/program_lexer.l:129 #2 0xffff8f53d24c in _mesa_program_lexer_lex ../src/mesa/program/program_lexer.l:312 #3 0xffff8f529d10 in yylex ../src/mesa/program/program_parse.y:289 #4 0xffff8f529d10 in yyparse src/mesa/program/program_parse.tab.c:2140 #5 0xffff8f5341a4 in _mesa_parse_arb_program ../src/mesa/program/program_parse.y:2589 #6 0xffff8f51e96c in _mesa_parse_arb_fragment_program ../src/mesa/program/arbprogparse.c:82 #7 0xffff8f4d867c in set_program_string ../src/mesa/main/arbprogram.c:402 Signed-off-by: Patrick Lerda <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21728>
1 parent a692fe4 commit ff7446b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/mesa/program/program_parse.y

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,6 +2068,7 @@ ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER
20682068
YYERROR;
20692069
} else {
20702070
_mesa_symbol_table_add_symbol(state->st, $2, target);
2071+
free($2);
20712072
}
20722073
(void)yynerrs;
20732074
}

0 commit comments

Comments
 (0)