null pointer dereferencing: fixed another false positive (#485)
This commit is contained in:
parent
05a1c50ff2
commit
0e208eb52f
|
@ -1051,6 +1051,9 @@ void CheckOther::nullPointer()
|
|||
--indentlevel2;
|
||||
}
|
||||
|
||||
else if (Token::Match(tok2, "%varid% =", varid1))
|
||||
break;
|
||||
|
||||
else if (tok2->str() == "if")
|
||||
{
|
||||
if (Token::Match(tok2, "if ( !| %varid% )", varid1))
|
||||
|
|
|
@ -488,6 +488,16 @@ private:
|
|||
" ;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// reassign struct..
|
||||
checkNullPointer("void foo(struct ABC *abc)\n"
|
||||
"{\n"
|
||||
" a = abc->a;\n"
|
||||
" abc = abc->next;\n"
|
||||
" if (!abc)\n"
|
||||
" ;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void checkOldStylePointerCast(const char code[])
|
||||
|
|
Loading…
Reference in New Issue