diff --git a/lib/checkautovariables.cpp b/lib/checkautovariables.cpp index ce3c89b31..785742515 100644 --- a/lib/checkautovariables.cpp +++ b/lib/checkautovariables.cpp @@ -339,7 +339,12 @@ void CheckAutoVariables::errorReturnTempReference(const Token *tok) void CheckAutoVariables::errorInvalidDeallocation(const Token *tok) { - reportError(tok, Severity::error, "autovarInvalidDeallocation", "Invalid deallocation"); + reportError(tok, + Severity::error, + "autovarInvalidDeallocation", + "Deallocating auto-variable is invalid\n" + "Deallocating an auto-variable is invalid. You should only free memory " + "that has been allocated dynamically."); } diff --git a/test/testautovariables.cpp b/test/testautovariables.cpp index dfe98c52b..ca4fdfc8d 100644 --- a/test/testautovariables.cpp +++ b/test/testautovariables.cpp @@ -297,7 +297,7 @@ private: "char tmp[256];\n" "free (tmp);\n" "}\n"); - ASSERT_EQUALS(std::string("[test.cpp:5]: (error) Invalid deallocation\n"), errout.str()); + ASSERT_EQUALS(std::string("[test.cpp:5]: (error) Deallocating auto-variable is invalid\n"), errout.str()); check("void f()\n" "{\n"