Fixed #1800 (false positive: memory leak when ptr used as map key)
This commit is contained in:
parent
bdd28b47aa
commit
d22da6088c
|
@ -1282,7 +1282,8 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
|||
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))
|
||||
Token::Match(tok, "= strcpy|strcat|memmove|memcpy ( %varid% ,", varid) ||
|
||||
Token::Match(tok, "[;{}] %var% [ %varid% ]", varid))
|
||||
{
|
||||
addtoken("use");
|
||||
}
|
||||
|
|
|
@ -499,6 +499,7 @@ private:
|
|||
ASSERT_EQUALS(";;use;", getcode("char *s; s2 = s + 10;", "s"));
|
||||
ASSERT_EQUALS(";;use;", getcode("char *s; s2 = x + s;", "s"));
|
||||
ASSERT_EQUALS(";;use;if{;}", getcode("char *s; if (foo(s)) ;", "s"));
|
||||
ASSERT_EQUALS(";;use;", getcode("char *s; map1[s] = 0;", "s"));
|
||||
|
||||
// return..
|
||||
ASSERT_EQUALS(";;return;", getcode("char *s; return;", "s"));
|
||||
|
|
Loading…
Reference in New Issue