]> granicus.if.org Git - clang/commitdiff
Always initialize NEXT_CATCH; fixes a Valgrind uninitialized read error
authorEli Friedman <eli.friedman@gmail.com>
Sun, 25 May 2008 04:34:57 +0000 (04:34 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sun, 25 May 2008 04:34:57 +0000 (04:34 +0000)
(originally reported in PR1682).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51551 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Stmt.cpp

index 6d8ebcf8649559a45f64fe341b6187f9e182b245..f89e2f40fac9192e4edc4da938593edc790f3a85 100644 (file)
@@ -170,9 +170,8 @@ ObjCAtCatchStmt::ObjCAtCatchStmt(SourceLocation atCatchLoc,
 : Stmt(ObjCAtCatchStmtClass) {
   SubExprs[SELECTOR] = catchVarStmtDecl;
   SubExprs[BODY] = atCatchStmt;
-  if (!atCatchList)
-    SubExprs[NEXT_CATCH] = NULL;
-  else {
+  SubExprs[NEXT_CATCH] = NULL;
+  if (atCatchList) {
     ObjCAtCatchStmt *AtCatchList = static_cast<ObjCAtCatchStmt*>(atCatchList);
 
     while (ObjCAtCatchStmt* NextCatch = AtCatchList->getNextCatchStmt())