[analyzer] Fix a bug in SimpleStreamChecker - return after sink.
authorAnna Zaks <ganna@apple.com>
Wed, 31 Oct 2012 22:17:48 +0000 (22:17 +0000)
committerAnna Zaks <ganna@apple.com>
Wed, 31 Oct 2012 22:17:48 +0000 (22:17 +0000)
Thanks Ted.

llvm-svn: 167176

clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp

index 4fe01c3..d62002c 100644 (file)
@@ -126,8 +126,10 @@ void SimpleStreamChecker::checkPreStmt(const CallExpr *Call,
   // Check if the stream has already been closed.
   ProgramStateRef State = C.getState();
   const StreamState *SS = State->get<StreamMap>(FileDesc);
-  if (SS && SS->isClosed())
+  if (SS && SS->isClosed()) {
     reportDoubleClose(FileDesc, Call, C);
+    return;
+  }
 
   // Generate the next transition, in which the stream is closed.
   State = State->set<StreamMap>(FileDesc, StreamState::getClosed());