Explicit continue instead of init-set-check

This commit is contained in:
Dmitry-Me 2016-08-05 15:05:37 +03:00
parent cbfeae0ff7
commit 89e8f51a28
1 changed files with 4 additions and 2 deletions

View File

@ -1438,15 +1438,17 @@ bool CheckClass::hasAllocation(const Function *func, const Scope* scope) const
return true;
// check for deallocating memory
const Token *var = nullptr;
const Token *var;
if (Token::Match(tok, "free ( %var%"))
var = tok->tokAt(2);
else if (Token::Match(tok, "delete [ ] %var%"))
var = tok->tokAt(3);
else if (Token::Match(tok, "delete %var%"))
var = tok->next();
else
continue;
// Check for assignment to the deleted pointer (only if its a member of the class)
if (var && isMemberVar(scope, var)) {
if (isMemberVar(scope, var)) {
for (const Token *tok1 = var->next(); tok1 && (tok1 != last); tok1 = tok1->next()) {
if (Token::Match(tok1, "%varid% =", var->varId()))
return true;