Fixed #1177 (False positive: pointer is not dereferenced 'sizeof(*p)')
This commit is contained in:
parent
2de2ecafe4
commit
06ee643c6a
|
@ -1557,6 +1557,9 @@ private:
|
|||
|
||||
if (Token::Match(&tok, "%var% ("))
|
||||
{
|
||||
if (Token::simpleMatch(&tok, "sizeof ("))
|
||||
return tok.next()->link();
|
||||
|
||||
// deallocate pointer
|
||||
if (Token::Match(&tok, "free|kfree|fclose ( %var% )"))
|
||||
{
|
||||
|
|
|
@ -1274,6 +1274,13 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: f\n", errout.str());
|
||||
|
||||
checkUninitVar("void f()\n"
|
||||
"{\n"
|
||||
" Abc *p;\n"
|
||||
" int sz = sizeof(*p);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// arrays..
|
||||
checkUninitVar("void f()\n"
|
||||
"{\n"
|
||||
|
|
Loading…
Reference in New Issue