From 6a0c463ebd9be64ee0ea50907c6f476572cb8611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 30 Dec 2011 10:32:55 +0100 Subject: [PATCH] #3382 (Clarify error message 'invalid deallocation') --- lib/checkautovariables.cpp | 7 ++++++- test/testautovariables.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) 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"