diff options
author | Brad King <brad.king@kitware.com> | 2007-12-17 22:55:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2007-12-17 22:55:21 (GMT) |
commit | 60149b33c1073adf044fd3723812f4e58faabce0 (patch) | |
tree | ece208f39a3d3ebed39ff88c0c23ad6c106169a3 /Source/cmDependsFortranParser.y | |
parent | ca5c5fc770570e5b8c18bed72a2288125b5cfc05 (diff) | |
download | CMake-60149b33c1073adf044fd3723812f4e58faabce0.zip CMake-60149b33c1073adf044fd3723812f4e58faabce0.tar.gz CMake-60149b33c1073adf044fd3723812f4e58faabce0.tar.bz2 |
BUG: Fixed memory-leaks in fortran parser.
Diffstat (limited to 'Source/cmDependsFortranParser.y')
-rw-r--r-- | Source/cmDependsFortranParser.y | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/cmDependsFortranParser.y b/Source/cmDependsFortranParser.y index 8e6456d..13c5f32 100644 --- a/Source/cmDependsFortranParser.y +++ b/Source/cmDependsFortranParser.y @@ -163,6 +163,9 @@ code: /* empty */ | code stmt; stmt: keyword_stmt | assignment_stmt; assignment_stmt: WORD ASSIGNMENT_OP other EOSTMT /* Ignore */ + { + free($1); + } keyword_stmt: WORD EOSTMT @@ -182,21 +185,18 @@ keyword_stmt: cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser_RuleUse(parser, $2); - free($2); } else if (cmDependsFortranParserIsKeyword($1, "module")) { cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser_RuleModule(parser, $2); - free($2); } else if (cmDependsFortranParserIsKeyword($1, "interface")) { cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser_SetInInterface(parser, true); - free($2); } else if (cmDependsFortranParserIsKeyword($2, "interface") && cmDependsFortranParserIsKeyword($1, "end")) @@ -204,11 +204,15 @@ keyword_stmt: cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser_SetInInterface(parser, false); - free($2); } free($1); + free($2); } | WORD STRING other EOSTMT /* Ignore */ + { + free($1); + free($2); + } | include STRING other EOSTMT { cmDependsFortranParser* parser = @@ -261,6 +265,9 @@ keyword_stmt: cmDependsFortranParser_RuleEndif(parser); } | WORD GARBAGE other EOSTMT /* Ignore */ + { + free($1); + } | GARBAGE other EOSTMT | EOSTMT | error |