Fixed #3065 (False positive: possible null pointer dereference: vi)
This commit is contained in:
parent
c7886ca1c4
commit
d098ed6031
|
@ -763,7 +763,7 @@ void CheckNullPointer::nullPointerByCheckAndDeRef()
|
||||||
|
|
||||||
// calling unknown function (abort/init)..
|
// calling unknown function (abort/init)..
|
||||||
if (Token::simpleMatch(tok2, ") ;") &&
|
if (Token::simpleMatch(tok2, ") ;") &&
|
||||||
(Token::Match(tok2->link()->tokAt(-2), "[;{}] %var% (") ||
|
(Token::Match(tok2->link()->tokAt(-2), "[;{}.] %var% (") ||
|
||||||
Token::Match(tok2->link()->tokAt(-5), "[;{}] ( * %var% ) (")))
|
Token::Match(tok2->link()->tokAt(-5), "[;{}] ( * %var% ) (")))
|
||||||
{
|
{
|
||||||
// noreturn function?
|
// noreturn function?
|
||||||
|
|
|
@ -1062,6 +1062,14 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("void foo(char *p) {\n"
|
||||||
|
" if (!p) {\n"
|
||||||
|
" ab.abort();\n"
|
||||||
|
" }\n"
|
||||||
|
" *p = 0;\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
check("void foo(char *p) {\n"
|
check("void foo(char *p) {\n"
|
||||||
" if (!p) {\n"
|
" if (!p) {\n"
|
||||||
" switch (x) { }\n"
|
" switch (x) { }\n"
|
||||||
|
|
Loading…
Reference in New Issue