diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index a826d92a2..feb60e2fb 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -7529,7 +7529,7 @@ static void valueFlowFunctionReturn(TokenList *tokenlist, ErrorLogger *errorLogg ProgramMemory programMemory; for (std::size_t i = 0; i < parvalues.size(); ++i) { const Variable * const arg = function->getArgumentVar(i); - if (!arg || !Token::Match(arg->typeStartToken(), "%type% %name% ,|)")) { + if (!arg) { if (tokenlist->getSettings()->debugwarnings) bailout(tokenlist, errorLogger, tok, "function return; unhandled argument type"); programMemory.clear(); diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index 852ba3908..cc8194e40 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -3707,6 +3707,11 @@ private: ASSERT_EQUALS("[test.cpp:3]: (error) Null pointer dereference: p\n" "[test.cpp:4]: (error) Null pointer dereference\n", errout.str()); + + check("const char* g(long) { return nullptr; }\n" // #11561 + "void f() { std::string s = g(0L); }\n"); + ASSERT_EQUALS("[test.cpp:2]: (error) Null pointer dereference: g(0L)\n", + errout.str()); } void nullpointerStdStream() {