Fixed #2142 (false positive: null pointer dereference (throw))
This commit is contained in:
parent
b6aca47e11
commit
fd153eac02
|
@ -2562,7 +2562,7 @@ void CheckOther::nullPointerByCheckAndDeRef()
|
|||
}
|
||||
}
|
||||
|
||||
if (Token::Match(tok2, "goto|return|continue|break|if"))
|
||||
if (Token::Match(tok2, "goto|return|continue|break|throw|if"))
|
||||
{
|
||||
if (Token::Match(tok2, "return * %var%"))
|
||||
nullPointerError(tok2, tok->strAt(3));
|
||||
|
|
|
@ -1189,6 +1189,14 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkNullPointer("void foo(char *p) {\n"
|
||||
" if (!p) {\n"
|
||||
" throw x;\n"
|
||||
" }\n"
|
||||
" *p = 0;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
}
|
||||
|
||||
void checkUninitVar(const char code[])
|
||||
|
|
Loading…
Reference in New Issue