Fixed #1363 (false positive: memory leak)
This commit is contained in:
parent
ebf36c1150
commit
71117378ef
|
@ -1122,6 +1122,7 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
|||
if (varid)
|
||||
{
|
||||
if (Token::Match(tok, "[)=] %varid% [+;)]", varid) ||
|
||||
Token::Match(tok, "%var% + %varid%", varid) ||
|
||||
Token::Match(tok, "%varid% +=|-=", varid) ||
|
||||
Token::Match(tok, "+=|<< %varid% ;", varid) ||
|
||||
Token::Match(tok, "= strcpy|strcat|memmove|memcpy ( %varid% ,", varid))
|
||||
|
|
|
@ -495,6 +495,7 @@ private:
|
|||
ASSERT_EQUALS(";;use;", getcode("char *s; abc.a(s);", "s"));
|
||||
ASSERT_EQUALS(";;use;", getcode("char *s; s2 = s;", "s"));
|
||||
ASSERT_EQUALS(";;use;", getcode("char *s; s2 = s + 10;", "s"));
|
||||
ASSERT_EQUALS(";;use;", getcode("char *s; s2 = x + s;", "s"));
|
||||
|
||||
// return..
|
||||
ASSERT_EQUALS(";;return;", getcode("char *s; return;", "s"));
|
||||
|
|
Loading…
Reference in New Issue