Fixed #2635 (False positive: resource leak)
This commit is contained in:
parent
e588f20e76
commit
be33f6b945
|
@ -1964,8 +1964,8 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// remove the "if* ;"
|
// remove the "if*"
|
||||||
Token::eraseTokens(tok2, tok2->tokAt(3));
|
Token::eraseTokens(tok2, tok2->tokAt(2));
|
||||||
}
|
}
|
||||||
done = false;
|
done = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -727,6 +727,10 @@ private:
|
||||||
|
|
||||||
// use ; dealloc ;
|
// use ; dealloc ;
|
||||||
ASSERT_EQUALS("; alloc ; use ; if return ; dealloc ;", simplifycode("; alloc ; use ; if { return ; } dealloc ;"));
|
ASSERT_EQUALS("; alloc ; use ; if return ; dealloc ;", simplifycode("; alloc ; use ; if { return ; } dealloc ;"));
|
||||||
|
|
||||||
|
// #2635 - false negative
|
||||||
|
ASSERT_EQUALS("; alloc ; return use ; }",
|
||||||
|
simplifycode("; alloc ; if(!var) { loop { ifv { } } alloc ; } return use; }"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue