memory leaks: fixed bug. return|else are not part of a variable declaration
This commit is contained in:
parent
eb05cf904d
commit
b5c6d7ba49
|
@ -627,9 +627,8 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
|||
if (parlevel == 0 && tok->str() == ";")
|
||||
addtoken(";");
|
||||
|
||||
if (varid &&
|
||||
(Token::Match(tok->previous(), "[(;{}] %varid% =", varid) ||
|
||||
Token::Match(tok, "asprintf ( & %varid% ,", varid)))
|
||||
if (Token::Match(tok->previous(), "[(;{}] %varid% =", varid) ||
|
||||
Token::Match(tok, "asprintf ( & %varid% ,", varid))
|
||||
{
|
||||
AllocType alloc;
|
||||
|
||||
|
@ -1782,6 +1781,10 @@ void CheckMemoryLeakInFunction::check()
|
|||
if (tok->next()->str() == "static")
|
||||
continue;
|
||||
|
||||
// return/else is not part of a variable declaration..
|
||||
if (Token::Match(tok->next(), "return|else"))
|
||||
continue;
|
||||
|
||||
if (Token::Match(tok, "[{};] %type% * const| %var% [;=]"))
|
||||
{
|
||||
const Token *vartok = tok->tokAt(tok->tokAt(3)->str() != "const" ? 3 : 4);
|
||||
|
|
Loading…
Reference in New Issue