Memory leaks : Remove "if break|continue ;" that may otherwise cause false positives
This commit is contained in:
parent
69137597f5
commit
8d6f77deed
|
@ -762,6 +762,14 @@ void CheckMemoryLeakClass::simplifycode(TOKEN *tok)
|
||||||
done = false;
|
done = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove the "if break|continue ;" that follows "dealloc ; alloc ;"
|
||||||
|
if ( ! _settings._showAll && TOKEN::Match(tok2, "dealloc ; alloc ; if break|continue ;") )
|
||||||
|
{
|
||||||
|
tok2 = tok2->next()->next()->next();
|
||||||
|
erase(tok2, tok2->tokAt(3));
|
||||||
|
done = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Reduce "if ; else %var% ;" => "if %var% ;"
|
// Reduce "if ; else %var% ;" => "if %var% ;"
|
||||||
if ( TOKEN::Match(tok2, "if ; else %var% ;") )
|
if ( TOKEN::Match(tok2, "if ; else %var% ;") )
|
||||||
|
@ -1048,7 +1056,7 @@ void CheckMemoryLeakClass::CheckMemoryLeak_CheckScope( const TOKEN *Tok1, const
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( (result = TOKEN::findmatch(tok, "alloc ; if break|continue|return ;")) != NULL )
|
else if ( (result = TOKEN::findmatch(tok, "alloc ; if break|continue|return ;")) != NULL )
|
||||||
{
|
{
|
||||||
MemoryLeak(result->tokAt(3), varname, alloctype);
|
MemoryLeak(result->tokAt(3), varname, alloctype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue