]> granicus.if.org Git - clang/commitdiff
Don't assert on a file stream if its state is not tracked. Fix pr7831.
authorZhongxing Xu <xuzhongxing@gmail.com>
Thu, 5 Aug 2010 23:24:13 +0000 (23:24 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Thu, 5 Aug 2010 23:24:13 +0000 (23:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110392 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/StreamChecker.cpp

index 37129be2450f23fa22485781cd78f1d3ffea30d5..b18ab2908c5891324ad0ded81e7d19bccd489bf8 100644 (file)
@@ -373,7 +373,10 @@ const GRState *StreamChecker::CheckDoubleClose(const CallExpr *CE,
   assert(Sym);
   
   const StreamState *SS = state->get<StreamState>(Sym);
-  assert(SS);
+
+  // If the file stream is not tracked, return.
+  if (!SS)
+    return state;
   
   // Check: Double close a File Descriptor could cause undefined behaviour.
   // Conforming to man-pages