Fixed #2184 (False Positive: memory leak)
This commit is contained in:
parent
4ddf6f3b44
commit
28c53cabea
|
@ -1838,10 +1838,12 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok)
|
|||
done = false;
|
||||
}
|
||||
|
||||
// Reduce "while1 ;" => "use ;"
|
||||
if (Token::simpleMatch(tok2, "while1 ;"))
|
||||
// Reduce "while1 continue| ;" => "use ;"
|
||||
if (Token::Match(tok2, "while1 continue| ;"))
|
||||
{
|
||||
tok2->str("use");
|
||||
if (tok2->strAt(1) == "continue")
|
||||
tok2->deleteNext();
|
||||
done = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -728,6 +728,7 @@ private:
|
|||
ASSERT_EQUALS("; alloc ; dealloc ; return ;", simplifycode("; alloc ; while1 { if { dealloc ; return ; } }"));
|
||||
ASSERT_EQUALS("; alloc ; dealloc ; return ;", simplifycode("; alloc ; while1 { if { dealloc ; return ; } if { continue ; } }"));
|
||||
ASSERT_EQUALS("; alloc ;", simplifycode("; alloc ; while1 { if { dealloc ; return ; } if { break ; } }"));
|
||||
ASSERT_EQUALS("; alloc ; use ; }", simplifycode("; alloc ; while1 { if { dealloc ; return ; } continue ; } ; }"));
|
||||
|
||||
ASSERT_EQUALS(";", simplifycode("; do { dealloc ; alloc ; } while(var) ;"));
|
||||
ASSERT_EQUALS("dealloc ; alloc ;", simplifycode("loop { dealloc ; alloc ; }"));
|
||||
|
|
Loading…
Reference in New Issue