Skip to content

Commit

Permalink
Update checkleakautovar.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Aug 8, 2024
1 parent 4b40070 commit ddaee3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/checkleakautovar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ void CheckLeakAutoVar::ret(const Token *tok, VarInfo &varInfo, const bool isEndO
const Token* const ifStart = ifEnd->link();
const Token* const alloc = it->second.allocTok;
if (precedes(ifStart, alloc) && succeeds(ifEnd, alloc)) { // allocation and check in if
if (Token::Match(outparamFunc->next()->astParent(), "%comp%"))
if (outparamFunc->next()->astParent() == ifStart || Token::Match(outparamFunc->next()->astParent(), "%comp%"))
continue;
} else { // allocation result assigned to variable
const Token* const retAssign = outparamFunc->next()->astParent();
Expand Down

0 comments on commit ddaee3f

Please sign in to comment.