Memory leaks: insert ';' in the simplifycode to split up the commands

This commit is contained in:
Daniel Marjamäki 2010-09-12 21:04:05 +02:00
parent 9c4a05a3bd
commit 0a30aba2e6
1 changed files with 12 additions and 0 deletions

View File

@ -1492,6 +1492,18 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok)
tok2->str("return");
}
// Insert extra ";"
for (Token *tok2 = tok; tok2; tok2 = tok2->next())
{
if (!tok2->previous() || Token::Match(tok2->previous(), "[;{}]"))
{
if (Token::Match(tok2, "assign|callfunc|use assign|callfunc|use"))
{
tok2->insertToken(";");
}
}
}
// remove redundant braces..
for (Token *start = tok; start; start = start->next())
{