Commit 62e216c3 authored by sebastien's avatar sebastien
Browse files

v4 preprocessor: fixed memory management error


git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1723 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 818e571f
......@@ -53,6 +53,11 @@ class ParsingDriver;
%lex-param { ParsingDriver &driver }
%locations
%initial-action
{
// Initialize the location filenames to NULL
@$.begin.filename = @$.end.filename = NULL;
}
%debug
%error-verbose
......
......@@ -401,6 +401,12 @@ int sigma_e = 0;
/* Add the native statement */
<NATIVE>.* { driver.add_native(yytext); BEGIN INITIAL; }
<*><<EOF>> {
if (yylloc->begin.filename)
delete yylloc->begin.filename;
yyterminate();
}
<*>. { driver.error(*yylloc, "character unrecognized by lexer"); }
%%
......
......@@ -75,9 +75,6 @@ ParsingDriver::parse(istream &in)
Dynare::parser parser(*this);
parser.parse();
if (location.begin.filename)
delete location.begin.filename;
delete lexer;
delete tmp_symbol_table;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment