Fixed #2192 (false positive: resource leak)
This commit is contained in:
parent
07f4067fa8
commit
0328d26fcb
|
@ -1317,7 +1317,9 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
|||
Token::simpleMatch(tok2->next(), "["))
|
||||
{
|
||||
}
|
||||
else if (f.empty() || !test_white_list(f.top()->str()))
|
||||
else if (f.empty() ||
|
||||
!test_white_list(f.top()->str()) ||
|
||||
getDeallocationType(f.top(),varid))
|
||||
{
|
||||
use = true;
|
||||
}
|
||||
|
|
|
@ -485,6 +485,7 @@ private:
|
|||
ASSERT_EQUALS(";;dealloc;", getcode("void *p; foo(fclose(p));", "p"));
|
||||
ASSERT_EQUALS(";;dealloc;", getcode("void *p; foo(close(p));", "p"));
|
||||
ASSERT_EQUALS(";;;;", getcode("FILE *f1; FILE *f2; fclose(f1);", "f2"));
|
||||
ASSERT_EQUALS(";;returnuse;", getcode("FILE *f; return fclose(f) == EOF ? 1 : 2;", "f"));
|
||||
|
||||
// if..
|
||||
ASSERT_EQUALS(";;if{}", getcode("char *s; if (a) { }", "s"));
|
||||
|
|
Loading…
Reference in New Issue