[Mesa-dev] glsl: memory leak in parsing extension statements?

Aras Pranckevicius aras at unity3d.com
Wed Aug 28 05:26:15 PDT 2013


Hi,

Looking at the code, is there a potential memory leak in GLSL parser wrt
extension statements?

glsl_lexer.ll has:
    <PP>[_a-zA-Z][_a-zA-Z0-9]* {
      yylval->identifier = strdup(yytext);
      return IDENTIFIER;
    }

i.e. calls strdup on the token (there's one other place that calls strdup;
whereas most regular identifiers use ralloc_strdup for easier memory
management.


glsl_parser.yy has this:

  extension_statement:
   EXTENSION any_identifier COLON any_identifier EOL
   {
      if (!_mesa_glsl_process_extension($2, & @2, $4, & @4, state)) {
         YYERROR;
      }
   }
   ;


which looks like it processes the extension identifiers, but never
frees the memory.




-- 

Aras Pranckevičius
work: http://unity3d.com
home: http://aras-p.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130828/f4ef6e7f/attachment.html>


More information about the mesa-dev mailing list