Visual Studio: Fixed unittests

This commit is contained in:
Daniel Marjamäki 2009-12-22 21:56:00 +01:00
parent 8cb4df30ea
commit cd2e501794
2 changed files with 12 additions and 6 deletions

View File

@ -305,9 +305,11 @@ void CheckMemoryLeak::reportErr(const std::list<const Token *> &callstack, Sever
for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it)
{
const Token * const tok = *it;
ErrorLogger::ErrorMessage::FileLocation loc;
loc.line = (*it)->linenr();
loc.file = tokenizer->file(*it);
loc.line = tok->linenr();
loc.file = tokenizer->file(tok);
locations.push_back(loc);
}
@ -2593,9 +2595,13 @@ private:
CheckLocalLeaks *C = dynamic_cast<CheckLocalLeaks *>(*it);
if (C && C->allocated)
{
CheckMemoryLeak *checkMemleak = dynamic_cast<CheckMemoryLeak *>(C->owner);
checkMemleak->memleakError(tok, C->varname, false);
foundError = true;
CheckMemoryLeakInFunction *checkMemleak = static_cast<CheckMemoryLeakInFunction *>(C->owner);
if (checkMemleak)
{
checkMemleak->memleakError(tok, C->varname, false);
foundError = true;
break;
}
}
}
}

View File

@ -141,7 +141,7 @@ public:
* -# finally, check if the simplified token list contain any leaks.
*/
class CheckMemoryLeakInFunction : private Check, private CheckMemoryLeak
class CheckMemoryLeakInFunction : private Check, public CheckMemoryLeak
{
public:
/** This constructor is used when registering this class */