Skip to content

Commit 1cf263d

Browse files
committed
fix #12238
1 parent 04c47db commit 1cf263d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/checkleakautovar.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,16 @@ bool CheckLeakAutoVar::checkScope(const Token * const startToken,
396396
}
397397
}
398398

399+
if (tok->isCpp11init() == TokenImpl::Cpp11init::CPP11INIT) {
400+
const Token *newTok = tok->astOperand1();
401+
const Token *oldTok = tok->astOperand2();
402+
if (newTok->varId() && oldTok->varId()) {
403+
leakIfAllocated(newTok, varInfo);
404+
// no multivariable checking currently => bail out for rhs variables
405+
varInfo.erase(oldTok->varId());
406+
}
407+
}
408+
399409
auto isAssignment = [](const Token* varTok) -> const Token* {
400410
if (varTok->varId()) {
401411
const Token* top = varTok;

0 commit comments

Comments
 (0)