summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>2014-09-03 16:38:31 +0300
committerTapani Pälli <tapani.palli@intel.com>2014-09-23 10:25:02 +0300
commit5a6ec26aec6c3a16df18270ec6cbc7e9fd3757cf (patch)
tree3063bfad4db926ae8ebe5f450f4800bf6d6a6f5f /src/glsl
parent6c9d67118a21e3713e006da4a03a584fb8268d92 (diff)
downloadexternal_mesa3d-5a6ec26aec6c3a16df18270ec6cbc7e9fd3757cf.zip
external_mesa3d-5a6ec26aec6c3a16df18270ec6cbc7e9fd3757cf.tar.gz
external_mesa3d-5a6ec26aec6c3a16df18270ec6cbc7e9fd3757cf.tar.bz2
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>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/glsl_lexer.ll9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index b7c4aad..e66a935 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -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);
}
}