mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-11 04:50:35 +01:00
glsl: Fix memory leak in glsl_lexer.ll
Running fast clear glClear with SNB caused Valgrind to complain about this. v2: line 237 fixed glClear from leaking memory, other strdups are also now changed to ralloc_strdups but I don't know what effect those have. At least no changes in my Piglit quick run. Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
parent
6c9d67118a
commit
5a6ec26aec
1 changed files with 6 additions and 3 deletions
|
|
@ -81,7 +81,8 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *);
|
|||
"illegal use of reserved word `%s'", yytext); \
|
||||
return ERROR_TOK; \
|
||||
} else { \
|
||||
yylval->identifier = strdup(yytext); \
|
||||
void *mem_ctx = yyextra; \
|
||||
yylval->identifier = ralloc_strdup(mem_ctx, yytext); \
|
||||
return classify_identifier(yyextra, yytext); \
|
||||
} \
|
||||
} while (0)
|
||||
|
|
@ -232,7 +233,8 @@ HASH ^{SPC}#{SPC}
|
|||
<PP>[ \t\r]* { }
|
||||
<PP>: return COLON;
|
||||
<PP>[_a-zA-Z][_a-zA-Z0-9]* {
|
||||
yylval->identifier = strdup(yytext);
|
||||
void *mem_ctx = yyextra;
|
||||
yylval->identifier = ralloc_strdup(mem_ctx, yytext);
|
||||
return IDENTIFIER;
|
||||
}
|
||||
<PP>[1-9][0-9]* {
|
||||
|
|
@ -409,7 +411,8 @@ layout {
|
|||
|| yyextra->ARB_compute_shader_enable) {
|
||||
return LAYOUT_TOK;
|
||||
} else {
|
||||
yylval->identifier = strdup(yytext);
|
||||
void *mem_ctx = yyextra;
|
||||
yylval->identifier = ralloc_strdup(mem_ctx, yytext);
|
||||
return classify_identifier(yyextra, yytext);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue