memory leaks: simplify 'callfunc ; ;'
This commit is contained in:
parent
df44703ee9
commit
ae0252dc91
|
@ -1465,7 +1465,8 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok)
|
|||
// reduce "; callfunc ; %var%"
|
||||
for (Token *tok2 = tok; tok2; tok2 = tok2->next())
|
||||
{
|
||||
if (Token::Match(tok2, ";|{|} callfunc ; %type%"))
|
||||
if (Token::Match(tok2, ";|{|} callfunc ; %type%") ||
|
||||
Token::Match(tok2, ";|{|} callfunc ; ;"))
|
||||
tok2->deleteNext();
|
||||
}
|
||||
|
||||
|
|
|
@ -708,6 +708,7 @@ private:
|
|||
|
||||
// callfunc..
|
||||
ASSERT_EQUALS("; callfunc ;", simplifycode(";callfunc;"));
|
||||
ASSERT_EQUALS(";", simplifycode(";callfunc;;"));
|
||||
ASSERT_EQUALS("while1 { dealloc ; alloc ; } return ; }", simplifycode("while1 { dealloc ; alloc ; } callfunc ; return ; }"));
|
||||
|
||||
// exit..
|
||||
|
|
Loading…
Reference in New Issue