#3382 (Clarify error message 'invalid deallocation')
This commit is contained in:
parent
2ae48c7aef
commit
6a0c463ebd
|
@ -339,7 +339,12 @@ void CheckAutoVariables::errorReturnTempReference(const Token *tok)
|
||||||
|
|
||||||
void CheckAutoVariables::errorInvalidDeallocation(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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ private:
|
||||||
"char tmp[256];\n"
|
"char tmp[256];\n"
|
||||||
"free (tmp);\n"
|
"free (tmp);\n"
|
||||||
"}\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"
|
check("void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue