Fixed #968 (False positive when TEMP_FAILURE_RETRY used)

This commit is contained in:
Daniel Marjamäki 2009-11-18 17:17:37 +01:00
parent 8f07e2711c
commit 42ffea4f16
2 changed files with 2 additions and 1 deletions

View File

@ -1119,7 +1119,7 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
else else
{ {
if (varid > 0 && Token::Match(tok, "%var% ( fclose|pclose ( %varid% ) ) ;", varid)) if (varid > 0 && Token::Match(tok, "%var% ( close|fclose|pclose ( %varid% ) ) ;", varid))
{ {
addtoken("dealloc"); addtoken("dealloc");
tok = tok->next()->link(); tok = tok->next()->link();

View File

@ -345,6 +345,7 @@ private:
ASSERT_EQUALS(";;dealloc;", getcode("char *s; delete [] s;", "s")); ASSERT_EQUALS(";;dealloc;", getcode("char *s; delete [] s;", "s"));
ASSERT_EQUALS(";;dealloc;", getcode("char *s; delete [] (s);", "s")); ASSERT_EQUALS(";;dealloc;", getcode("char *s; delete [] (s);", "s"));
ASSERT_EQUALS(";;dealloc;", getcode("void *p; foo(fclose(p));", "p")); ASSERT_EQUALS(";;dealloc;", getcode("void *p; foo(fclose(p));", "p"));
ASSERT_EQUALS(";;dealloc;", getcode("void *p; foo(close(p));", "p"));
// if.. // if..
ASSERT_EQUALS(";;if{}", getcode("char *s; if (a) { }", "s")); ASSERT_EQUALS(";;if{}", getcode("char *s; if (a) { }", "s"));