Memory leak : Fixed issue 2429936 - false positive reported on the break in the code "loop { dealloc ; alloc ; if break ; }"
This commit is contained in:
parent
87de37bcb4
commit
b145bf3650
|
@ -787,6 +787,17 @@ void CheckMemoryLeakClass::simplifycode(TOKEN *tok)
|
|||
done = false;
|
||||
}
|
||||
|
||||
// Reduce "loop { assign|dealloc|use ; alloc ; if break ; }" to "assign|dealloc|use ; alloc ;"
|
||||
if ( TOKEN::Match( tok2->next(), "loop { assign|dealloc|use ; alloc ; if break|continue ; }" ) )
|
||||
{
|
||||
// erase "loop {"
|
||||
erase( tok2, tok2->tokAt(3) );
|
||||
// erase "if break|continue ; }"
|
||||
tok2 = tok2->next()->next()->next()->next();
|
||||
erase( tok2, tok2->tokAt(5) );
|
||||
done = false;
|
||||
}
|
||||
|
||||
// Reduce "if(true) X ;" => "X ;"
|
||||
if (TOKEN::Match(tok2->next(), "if(true) %var% ; !!else") )
|
||||
{
|
||||
|
|
|
@ -97,7 +97,7 @@ private:
|
|||
TEST_CASE( forwhile5 );
|
||||
TEST_CASE( forwhile6 );
|
||||
TEST_CASE( forwhile7 );
|
||||
// TODO TEST_CASE( forwhile8 ); // Bug 2429936
|
||||
TEST_CASE( forwhile8 ); // Bug 2429936
|
||||
|
||||
TEST_CASE( dowhile1 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue