From: Zhongxing Xu Date: Thu, 5 Aug 2010 23:24:13 +0000 (+0000) Subject: Don't assert on a file stream if its state is not tracked. Fix pr7831. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c7370f933e4f413d8cc8964ff946d4261da2e78;p=clang Don't assert on a file stream if its state is not tracked. Fix pr7831. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110392 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Checker/StreamChecker.cpp b/lib/Checker/StreamChecker.cpp index 37129be245..b18ab2908c 100644 --- a/lib/Checker/StreamChecker.cpp +++ b/lib/Checker/StreamChecker.cpp @@ -373,7 +373,10 @@ const GRState *StreamChecker::CheckDoubleClose(const CallExpr *CE, assert(Sym); const StreamState *SS = state->get(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