memleak: fixed todo test case

This commit is contained in:
Daniel Marjamäki 2009-07-07 15:22:37 +02:00
parent ddc1ad7d4d
commit 2a02041fd8
2 changed files with 7 additions and 1 deletions

View File

@ -1569,6 +1569,12 @@ void CheckMemoryLeakInFunction::checkScope(const Token *Tok1, const char varname
memoryLeak(last, varname, alloctype, all);
}
else if ((result = Token::findmatch(tok, "alloc ; }")) != NULL)
{
if (result->tokAt(3) == NULL)
memoryLeak(result->tokAt(2), varname, alloctype, all);
}
// detect cases that "simplifycode" don't handle well..
else if (_settings->_debug)
{

View File

@ -444,7 +444,7 @@ private:
" foo(s);\n"
" s = malloc(100);\n"
"}\n");
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Memory leak: s\n", errout.str());
ASSERT_EQUALS("[test.cpp:6]: (error) Memory leak: s\n", errout.str());
}