Fixed #2285 (False Positive: memory leak)
This commit is contained in:
parent
bc30c7d23b
commit
cad9c5f232
|
@ -1847,10 +1847,10 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok)
|
|||
}
|
||||
|
||||
// Reduce "while1 continue| ;" => "use ;"
|
||||
if (Token::Match(tok2, "while1 continue| ;"))
|
||||
if (Token::Match(tok2, "while1 if| continue| ;"))
|
||||
{
|
||||
tok2->str("use");
|
||||
if (tok2->strAt(1) == "continue")
|
||||
while (tok2->strAt(1) != ";")
|
||||
tok2->deleteNext();
|
||||
done = false;
|
||||
}
|
||||
|
|
|
@ -668,6 +668,8 @@ private:
|
|||
ASSERT_EQUALS(";", simplifycode("; loop { if { continue ; } else { if continue ; } }"));
|
||||
ASSERT_EQUALS(";", simplifycode("; loop { { if continue ; if continue ; } }"));
|
||||
|
||||
ASSERT_EQUALS(";", simplifycode("; while1 { if { dealloc ; return ; } if { if { continue ; } } }"));
|
||||
|
||||
// scope..
|
||||
// current result - ok
|
||||
ASSERT_EQUALS("; assign ; dealloc ; if alloc ; }", simplifycode("; assign ; { dealloc ; if alloc ; } }"));
|
||||
|
|
Loading…
Reference in New Issue