Fixed #919 (possible memory leak not detected)
This commit is contained in:
parent
2ec5438186
commit
1187587521
|
@ -1268,7 +1268,7 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok, bool &all)
|
|||
// Otherwise, only the "if" will be deleted
|
||||
else if (Token::Match(tok2, "[;{}] if assign|dealloc|use ; !!else"))
|
||||
{
|
||||
if (_settings->_showAll && !Token::simpleMatch(tok2->tokAt(2), "dealloc ; dealloc"))
|
||||
if (_settings->_showAll && tok2->tokAt(2)->str() != "assign" && !Token::simpleMatch(tok2->tokAt(2), "dealloc ; dealloc"))
|
||||
{
|
||||
Token::eraseTokens(tok2, tok2->tokAt(3));
|
||||
all = true;
|
||||
|
|
|
@ -488,6 +488,7 @@ private:
|
|||
ASSERT_EQUALS("; alloc ;", simplifycode("; alloc; if { dealloc; return; }"));
|
||||
ASSERT_EQUALS("; alloc ;", simplifycode("; alloc; if { return use; }"));
|
||||
ASSERT_EQUALS("; alloc ; return ;", simplifycode(";alloc;if{return;}return;"));
|
||||
ASSERT_EQUALS("; alloc ; assign ; dealloc ;", simplifycode(";alloc;if{assign;}dealloc;"));
|
||||
|
||||
// switch..
|
||||
ASSERT_EQUALS("; alloc ; dealloc ;", simplifycode(";alloc;switch{case;break;};dealloc;"));
|
||||
|
|
Loading…
Reference in New Issue