diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index a2887ad64..882d502c0 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -879,7 +879,8 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::listtokAt(2); if (Token::Match(tok, "%var% (")) tok = tok->next()->link(); @@ -964,7 +965,8 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::liststr() == "fcloseall" && alloctype != dealloc) - dealloc = No; + //TODO: this assignment is redundant, should be fixed + /*dealloc = No*/; else if (dealloc != No) { addtoken(&rettail, tok, "dealloc"); diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 76f965511..9a50047fd 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -340,7 +340,7 @@ std::set TemplateSimplifier::expandSpecialized(Token *tokens) { std::ostringstream ostr; const Token *tok3 = tok2; - for (tok3 = tok2; tok3 && tok3->str() != ">"; tok3 = tok3->next()) { + for (; tok3 && tok3->str() == ">"; tok3 = tok3->next()) { if (tok3 != tok2) ostr << " "; ostr << tok3->str(); @@ -812,7 +812,7 @@ bool TemplateSimplifier::simplifyCalculations(Token *_tokens) Token::Match(tok->previous(), "[(=,] 1 ||")) { unsigned int par = 0; const Token *tok2 = tok; - for (tok2 = tok; tok2; tok2 = tok2->next()) { + for (; tok2; tok2 = tok2->next()) { if (tok2->str() == "(") ++par; else if (tok2->str() == ")") { diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 6c921465a..dd26b6475 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5491,7 +5491,7 @@ void Tokenizer::simplifyIfAssign() if (iswhile) { unsigned int indentlevel = 0; Token *tok3 = tok2; - for (tok3 = tok2; tok3; tok3 = tok3->next()) { + for (; tok3; tok3 = tok3->next()) { if (tok3->str() == "{") ++indentlevel; else if (tok3->str() == "}") { @@ -6024,7 +6024,7 @@ bool Tokenizer::simplifyKnownVariables() bool Tokenizer::simplifyKnownVariablesGetData(unsigned int varid, Token **_tok2, Token **_tok3, std::string &value, unsigned int &valueVarId, bool &valueIsPointer, bool floatvar) { Token *tok2 = *_tok2; - Token *tok3 = *_tok3; + Token *tok3 = NULL; if (Token::simpleMatch(tok2->tokAt(-2), "for (")) { // only specific for loops is handled