Fixed #2141 (false positive: possible null pointer dereference)
This commit is contained in:
parent
fd153eac02
commit
fc98bcdcb2
|
@ -2543,6 +2543,8 @@ void CheckOther::nullPointerByCheckAndDeRef()
|
|||
{
|
||||
bool null = true;
|
||||
const unsigned int varid(tok->tokAt(3)->varId());
|
||||
if (varid == 0)
|
||||
continue;
|
||||
unsigned int indentlevel = 1;
|
||||
for (const Token *tok2 = tok->tokAt(6); tok2; tok2 = tok2->next())
|
||||
{
|
||||
|
|
|
@ -1197,6 +1197,13 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkNullPointer("void foo() {\n"
|
||||
" if (!p) {\n"
|
||||
" switch (x) { }\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
}
|
||||
|
||||
void checkUninitVar(const char code[])
|
||||
|
|
Loading…
Reference in New Issue