mismathing allocation and deallocation: moved to error checks

This commit is contained in:
Daniel Marjamäki 2009-02-06 18:24:01 +00:00
parent 3c7e40fe13
commit 03acc12977
3 changed files with 5 additions and 5 deletions

View File

@ -353,7 +353,7 @@ void CppCheck::checkFile(const std::string &code, const char FileName[])
// Memory leak
CheckMemoryLeakClass checkMemoryLeak(&_tokenizer, _settings, this);
if (ErrorMessage::memleak() || ErrorMessage::mismatchAllocDealloc(_settings))
if (ErrorMessage::memleak() || ErrorMessage::mismatchAllocDealloc())
checkMemoryLeak.CheckMemoryLeak();
// Check that all class constructors are ok.

View File

@ -136,11 +136,11 @@ public:
static void mismatchAllocDealloc(ErrorLogger *logger, const Tokenizer *tokenizer, const std::list<const Token *> &Location, const std::string &varname)
{
_writemsg(logger, tokenizer, Location, "all", "Mismatching allocation and deallocation: " + varname + "", "mismatchAllocDealloc");
_writemsg(logger, tokenizer, Location, "error", "Mismatching allocation and deallocation: " + varname + "", "mismatchAllocDealloc");
}
static bool mismatchAllocDealloc(const Settings &s)
static bool mismatchAllocDealloc()
{
return s._showAll;
return true;
}
static void memleak(ErrorLogger *logger, const Tokenizer *tokenizer, const Token *Location, const std::string &varname)

View File

@ -75,7 +75,7 @@ int main()
err.push_back(Message("unusedFunction", Message::style_all, "[%1]: The function '%2' is never used", "filename", "funcname"));
// checkmemoryleak.cpp..
err.push_back(Message("mismatchAllocDealloc", Message::all, "Mismatching allocation and deallocation: %1", "varname"));
err.push_back(Message("mismatchAllocDealloc", Message::error, "Mismatching allocation and deallocation: %1", "varname"));
err.push_back(Message("memleak", Message::error, "Memory leak: %1", "varname"));
err.push_back(Message("memleakall", Message::all, "Memory leak: %1", "varname"));
err.push_back(Message("resourceLeak", Message::error, "Resource leak: %1", "varname"));