This commit is contained in:
Daniel Marjamäki 2009-08-29 08:20:18 +02:00
parent ee5b2a43c7
commit 88d0bd3908
2 changed files with 2 additions and 2 deletions

View File

@ -764,7 +764,7 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
// if else switch // if else switch
if (tok->str() == "if") if (tok->str() == "if")
{ {
if (alloctype == Fd && if (alloctype == Fd &&
(Token::Match(tok, "if ( %varid% >= 0 )", varid) || (Token::Match(tok, "if ( %varid% >= 0 )", varid) ||
Token::Match(tok, "if ( %varid% != -1 )", varid))) Token::Match(tok, "if ( %varid% != -1 )", varid)))
{ {

View File

@ -355,7 +355,7 @@ private:
ASSERT_EQUALS(";;alloc;", getcode("char *s; asprintf(&s, \"s: %s\", s);", "s")); ASSERT_EQUALS(";;alloc;", getcode("char *s; asprintf(&s, \"s: %s\", s);", "s"));
ASSERT_EQUALS(";;;", getcode("char *s; asprintf(&p, \"s: %s\", s);", "s")); ASSERT_EQUALS(";;;", getcode("char *s; asprintf(&p, \"s: %s\", s);", "s"));
// Since we don't check how the return value is used we must bail out // Since we don't check how the return value is used we must bail out
ASSERT_EQUALS("", getcode("char *s; int ret = asprintf(&s, \"xyz\");", "s")); ASSERT_EQUALS("", getcode("char *s; int ret = asprintf(&s, \"xyz\");", "s"));
TODO_ASSERT_EQUALS(";;alloc;", getcode("char *s; int ret; ret=asprintf(&s, \"xyz\"); if (ret==-1) return;", "s")); TODO_ASSERT_EQUALS(";;alloc;", getcode("char *s; int ret; ret=asprintf(&s, \"xyz\"); if (ret==-1) return;", "s"));