Memory leaks: fixed a todo testcase
This commit is contained in:
parent
59a4a36fe1
commit
7ba244cf45
|
@ -1633,6 +1633,11 @@ const Token *CheckMemoryLeakInFunction::findleak(const Token *tokens, bool all)
|
|||
return result->tokAt(2);
|
||||
}
|
||||
|
||||
if ((result = Token::findmatch(tokens, "alloc ; if assign ;")) != NULL)
|
||||
{
|
||||
return result->tokAt(3);
|
||||
}
|
||||
|
||||
if ((result = Token::findmatch(tokens, "alloc ; }")) != NULL)
|
||||
{
|
||||
if (result->tokAt(3) == NULL)
|
||||
|
|
|
@ -558,7 +558,8 @@ private:
|
|||
|
||||
// assign..
|
||||
ASSERT_EQUALS(2, dofindleak("alloc;\n assign;\n dealloc;"));
|
||||
ASSERT_EQUALS(-1, dofindleak("alloc;\n if(!var) assign;\n dealloc;"));
|
||||
ASSERT_EQUALS(-1, dofindleak("alloc;\n if(!var) assign;\n dealloc;"));
|
||||
ASSERT_EQUALS(2, dofindleak("alloc;\n if assign;\n dealloc;"));
|
||||
|
||||
// loop..
|
||||
ASSERT_EQUALS(1, dofindleak("; loop { alloc ; if break; dealloc ; }"));
|
||||
|
@ -570,9 +571,6 @@ private:
|
|||
ASSERT_EQUALS(-1, dofindleak("; alloc;\n if { dealloc; }\n ;"));
|
||||
TODO_ASSERT_EQUALS(3, dofindleak("; alloc;\n if { dealloc; }\n ;"));
|
||||
|
||||
ASSERT_EQUALS(-1, dofindleak("alloc;\n if assign;\n dealloc;"));
|
||||
TODO_ASSERT_EQUALS(2, dofindleak("alloc;\n if assign;\n dealloc;"));
|
||||
|
||||
ASSERT_EQUALS(-1, dofindleak("alloc; if { return use; }"));
|
||||
TODO_ASSERT_EQUALS(1, dofindleak("alloc; if { return use; }"));
|
||||
ASSERT_EQUALS(-1, dofindleak("alloc; if { dealloc; return; }"));
|
||||
|
|
Loading…
Reference in New Issue