Fixed #1268 (Null pointer dereference false positive)

This commit is contained in:
Daniel Marjamäki 2010-01-14 20:02:38 +01:00
parent bc5800004b
commit a7bddc8fd3
2 changed files with 9 additions and 0 deletions

View File

@ -1278,6 +1278,9 @@ private:
if (Token::Match(&tok, "%var% ("))
{
if (tok.str() == "sizeof")
return tok.next()->link();
// parse usage..
std::list<const Token *> var;
parseFunctionCall(tok, var, 0);

View File

@ -970,6 +970,12 @@ private:
" p->do_something();\n"
"}\n");
ASSERT_EQUALS("", errout.str());
checkNullPointer("void foo()\n"
"{\n"
" int sz = sizeof((*(struct dummy *)0).x);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void nullpointer7()