Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Unified Diff: src/glsl/glsl_lexer.ll

Issue 1380873002: Merged fix for memory leak from glsl_lexer.ll (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/mesa.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chromium_gensrc/mesa/glsl_lexer.cc ('K') | « chromium_gensrc/mesa/glsl_lexer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/glsl/glsl_lexer.ll
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index 24cda0c45eae6242792474a6ce29ca7e1d9037d0..bd336d1893bf2ea5901a197b345cad6cc4fc32e2 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -66,7 +66,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)
@@ -208,7 +209,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]* {
@@ -316,7 +318,8 @@ layout {
|| yyextra->ARB_fragment_coord_conventions_enable) {
return LAYOUT_TOK;
} else {
- yylval->identifier = strdup(yytext);
+ void *mem_ctx = yyextra;
+ yylval->identifier = ralloc_strdup(mem_ctx, yytext);
return IDENTIFIER;
}
}
« chromium_gensrc/mesa/glsl_lexer.cc ('K') | « chromium_gensrc/mesa/glsl_lexer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698