[Mesa-dev] [PATCH] glsl: Fix memory leak in glsl_lexer.ll

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Wed Sep 3 07:03:30 PDT 2014


Running fast clear glClear with SNB caused Valgrind to
complain about this.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/glsl/glsl_lexer.ll | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index b7c4aad..a9274a3 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -232,7 +232,8 @@ HASH		^{SPC}#{SPC}
 <PP>[ \t\r]*			{ }
 <PP>:				return COLON;
 <PP>[_a-zA-Z][_a-zA-Z0-9]*	{
-				   yylval->identifier = strdup(yytext);
+				   void *ctx = yyextra;
+				   yylval->identifier = ralloc_strdup(ctx, yytext);
 				   return IDENTIFIER;
 				}
 <PP>[1-9][0-9]*			{
-- 
1.8.5.1



More information about the mesa-dev mailing list