Skip to content

Commit 114bc84

Browse files
Update checkmemoryleak.cpp
1 parent eb4cd17 commit 114bc84

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/checkmemoryleak.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -859,10 +859,9 @@ void CheckMemoryLeakStructMember::checkStructVariable(const Variable* const vari
859859
int indentlevel3 = indentlevel2;
860860
for (const Token *tok3 = tok2; tok3; tok3 = tok3->next()) {
861861
if (tok3->str() == "{") {
862-
if (tok3->scope()->type == ScopeType::eIf) { // bailout: member checked in if condition
862+
if (tok3->scope()->type == ScopeType::eIf && tok3 == tok3->scope()->bodyStart) { // bailout: member checked in if condition
863863
const Token* const condBeg = tok3->scope()->classDef->tokAt(1);
864-
const Token* const condEnd = condBeg->link();
865-
if (Token::findmatch(condBeg, ". %varid%", condEnd, assignToks.first->varId()))
864+
if (Token::findmatch(condBeg, ". %varid%", condBeg->link(), assignToks.first->varId()))
866865
break;
867866
}
868867
++indentlevel3;

0 commit comments

Comments
 (0)