Skip to content

Commit 5fac1f2

Browse files
Update checkleakautovar.cpp
1 parent bc88bec commit 5fac1f2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/checkleakautovar.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ bool CheckLeakAutoVarImpl::checkScope(const Token * const startToken,
342342
}
343343
}
344344

345+
if (tok->str() == "}" && tok == tok->scope()->bodyEnd && tok->scope()->type == ScopeType::eUnconditional)
346+
ret(tok, varInfo);
345347

346348
// look for end of statement
347349
const bool isInit = Token::Match(tok->tokAt(-1), "%var% {|(") && tok->tokAt(-1)->variable() && tok->tokAt(-1) == tok->tokAt(-1)->variable()->nameToken();

0 commit comments

Comments
 (0)