<div dir="ltr">Hi,<div><br></div><div>Looking at the code, is there a potential memory leak in GLSL parser wrt extension statements?</div><div><br></div>glsl_lexer.ll has:<br> <PP>[_a-zA-Z][_a-zA-Z0-9]* {<br> yylval->identifier = strdup(yytext);<br>
return IDENTIFIER;<br> }<div><br><div>i.e. calls strdup on the token (there's one other place that calls strdup; whereas most regular identifiers use <span style="color:rgb(0,0,0);font-size:13px">ralloc_strdup for easier memory management.</span></div>
<div><br><div><br></div><div>glsl_parser.yy has this:</div><div><br></div><div><pre style="padding:0px;margin-top:0px;margin-bottom:0px"><font face="arial, helvetica, sans-serif"> extension_statement:<br> EXTENSION any_identifier COLON any_identifier EOL<br>
{<br> if (!_mesa_glsl_process_extension($2, & @2, $4, & @4, state)) {<br> YYERROR;<br> }<br> }<br> ;</font></pre><pre style="padding:0px;margin-top:0px;margin-bottom:0px"><br></pre><pre style="padding:0px;margin-top:0px;margin-bottom:0px">
<font face="arial, helvetica, sans-serif">which looks like it processes the extension identifiers, but never frees the memory.</font></pre><pre style="padding:0px;margin-top:0px;margin-bottom:0px"><br></pre><pre style="padding:0px;margin-top:0px;margin-bottom:0px">
<font face="arial, helvetica, sans-serif"><br></font></pre><pre style="padding:0px;margin-top:0px;margin-bottom:0px"><br><span style="font-family:arial">-- </span><br></pre><div>Aras Pranckevičius<br>work: <a href="http://unity3d.com">http://unity3d.com</a><br>
home: <a href="http://aras-p.info">http://aras-p.info</a>
</div></div></div><div><br></div></div></div>