close File yyin before calling yylex_destroy

This patch makes sure file handler yyin is closed.
yylex_destroy() calls yy_init_globals(), which reset yyin to 0.
Therefore if we do not close yyin before yylex_destroy(), yyin
will not be closed anymore.
This commit is contained in:
Homer Hsing 2012-09-06 16:12:08 +08:00 committed by Damien Lespiau
parent 31401afe78
commit aab7cd5cc5

View File

@ -275,11 +275,11 @@ int main(int argc, char **argv)
err = yyparse(); err = yyparse();
yylex_destroy(); if (strcmp(argv[0], "-"))
if (yyin)
fclose(yyin); fclose(yyin);
yylex_destroy();
if (err || errors) if (err || errors)
exit (1); exit (1);