Improved message 'mismatchSize' (#4167)

This commit is contained in:
PKEuS 2014-09-02 09:38:40 +02:00
parent d118a56b42
commit 2d608890a5
2 changed files with 4 additions and 3 deletions

View File

@ -385,7 +385,7 @@ void CheckMemoryLeak::deallocuseError(const Token *tok, const std::string &varna
void CheckMemoryLeak::mismatchSizeError(const Token *tok, const std::string &sz) const
{
reportErr(tok, Severity::error, "mismatchSize", "The given size " + sz + " is mismatching");
reportErr(tok, Severity::error, "mismatchSize", "The allocated size " + sz + " is not a multiple of the underlying type's size.");
}
void CheckMemoryLeak::mismatchAllocDealloc(const std::list<const Token *> &callstack, const std::string &varname) const

View File

@ -3490,13 +3490,14 @@ private:
" int *p = malloc(3);\n"
" free(p);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (error) The given size 3 is mismatching\n", errout.str());
ASSERT_EQUALS("[test.cpp:3]: (error) The allocated size 3 is not a multiple of the underlying type's size.\n", errout.str());
check("void foo()\n"
"{\n"
" int *p = g_malloc(3);\n"
" g_free(p);\n"
"}\n");
TODO_ASSERT_EQUALS("[test.cpp:3]: (error) The given size 3 is mismatching\n", "", errout.str());
TODO_ASSERT_EQUALS("[test.cpp:3]: (error) The allocated size 3 is not a multiple of the underlying type's size.\n", "", errout.str());
}