Fixed #1159 (Valgrind gives error in Tokenizer::simplifyWhile0)

This commit is contained in:
Daniel Marjamäki 2009-12-28 16:32:34 +01:00
parent 9aca2e7680
commit 6a31fe6403
1 changed files with 2 additions and 2 deletions

View File

@ -4969,9 +4969,9 @@ void Tokenizer::simplifyWhile0()
// remove "while (0) { .. }"
if (Token::simpleMatch(tok->tokAt(4), "{"))
{
Token::eraseTokens(tok, tok->tokAt(4)->link());
const Token *end = tok->tokAt(4)->link();
Token::eraseTokens(tok, end ? end->next() : 0);
tok->deleteThis(); // delete "while"
tok->deleteThis(); // delete "}"
}
if (Token::simpleMatch(tok->previous(), "}"))