CheckMemoryLeakInFunction(getcode): don't call Token::Match() if varid equals to zero.

This commit is contained in:
Slava Semushin 2009-08-29 16:27:56 +07:00
parent fe1101771a
commit 78d44e67ef
1 changed files with 3 additions and 2 deletions

View File

@ -627,8 +627,9 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
if (parlevel == 0 && tok->str() == ";")
addtoken(";");
if (Token::Match(tok->previous(), "[(;{}] %varid% =", varid) ||
Token::Match(tok, "asprintf ( & %varid% ,", varid))
if (varid &&
(Token::Match(tok->previous(), "[(;{}] %varid% =", varid) ||
Token::Match(tok, "asprintf ( & %varid% ,", varid)))
{
AllocType alloc;