Skip to content

Commit

Permalink
Fix #11786 deferencing fail to warn after the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon LONG committed May 10, 2024
1 parent 37dc795 commit 8bdf7e9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/checkleakautovar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,11 @@ bool CheckLeakAutoVar::checkScope(const Token * const startToken,
}
}

// Handle loops (possible?)
else if (Token::Match(tok, "for|while|do")) {
continue;
}

// unknown control.. (TODO: handle loops)
else if ((Token::Match(tok, "%type% (") && Token::simpleMatch(tok->linkAt(1), ") {")) || Token::simpleMatch(tok, "do {")) {
varInfo.clear();
Expand Down

0 comments on commit 8bdf7e9

Please sign in to comment.