memory leaks: fixed a todo testcase to find more leaks

This commit is contained in:
Daniel Marjamäki 2009-09-01 20:12:53 +02:00
parent 9a47b7110e
commit 93659bbe08
2 changed files with 2 additions and 5 deletions

View File

@ -1187,7 +1187,7 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok, bool &all)
}
// Reduce "if return ; alloc ;" => "alloc ;"
else if (Token::Match(tok2, "[;{}] if return ; alloc ;"))
else if (Token::Match(tok2, "[;{}] if return ; alloc|return ;"))
{
Token::eraseTokens(tok2, tok2->tokAt(4));
done = false;

View File

@ -453,6 +453,7 @@ private:
ASSERT_EQUALS("; if(!var) xxx ;", simplifycode("; if(var) ; else xxx ;"));
ASSERT_EQUALS("; ifv xxx ;", simplifycode("; ifv ; else xxx ;"));
ASSERT_EQUALS("; alloc ;", simplifycode("; alloc; if { dealloc; return; }"));
ASSERT_EQUALS("; alloc ; return ;", simplifycode(";alloc;if{return;}return;"));
// switch..
@ -474,10 +475,6 @@ private:
TODO_ASSERT_EQUALS(";", simplifycode("; alloc ; if(var) { exit; }"));
TODO_ASSERT_EQUALS(";", simplifycode("; alloc ; ifv { exit; }", false));
TODO_ASSERT_EQUALS("; alloc ;", simplifycode("; alloc ; ifv { exit; }", true));
ASSERT_EQUALS("; alloc ; if return ; return ;", simplifycode(";alloc;if{return;}return;"));
TODO_ASSERT_EQUALS("; alloc ; return ;", simplifycode(";alloc;if{return;}return;"));
}