memleak: fixed todo test case
This commit is contained in:
parent
ddc1ad7d4d
commit
2a02041fd8
|
@ -1569,6 +1569,12 @@ void CheckMemoryLeakInFunction::checkScope(const Token *Tok1, const char varname
|
||||||
memoryLeak(last, varname, alloctype, all);
|
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..
|
// detect cases that "simplifycode" don't handle well..
|
||||||
else if (_settings->_debug)
|
else if (_settings->_debug)
|
||||||
{
|
{
|
||||||
|
|
|
@ -444,7 +444,7 @@ private:
|
||||||
" foo(s);\n"
|
" foo(s);\n"
|
||||||
" s = malloc(100);\n"
|
" s = malloc(100);\n"
|
||||||
"}\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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue