diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index cd9863398..11a8163bd 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -553,7 +553,8 @@ void CheckNullPointer::nullPointerByCheckAndDeRef() // calling unknown function (abort/init).. 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% ) ("))) { break; } diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index ece9477dd..316d71dbc 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -754,6 +754,14 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + check("void foo(char *p) {\n" + " if (!p) {\n" + " (*bail)();\n" + " }\n" + " *p = 0;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + check("void foo(char *p) {\n" " if (!p) {\n" " throw x;\n"