Fixed #1397 (false positive: Memory leak in while loop)
This commit is contained in:
parent
9b6336013b
commit
ce0131a1e6
|
@ -2978,6 +2978,8 @@ bool Tokenizer::simplifyTokenList()
|
|||
simplifyNestedStrcat();
|
||||
simplifyWhile0();
|
||||
|
||||
simplifyIfAssign(); // could be affected by simplifyIfNot
|
||||
|
||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||
{
|
||||
if (Token::Match(tok, "case %any% : %var%"))
|
||||
|
|
|
@ -1700,6 +1700,8 @@ private:
|
|||
tok("struct hfs_bnode *node;"
|
||||
"struct hfs_btree *tree;"
|
||||
"while ((node = tree->node_hash[i++])) { }"));
|
||||
ASSERT_EQUALS("char * s ; s = new char [ 10 ] ; while ( ! s ) { s = new char [ 10 ] ; }",
|
||||
tok("char *s; while (0 == (s=new char[10])) { }"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue