From: Eli Friedman Date: Sun, 25 May 2008 04:34:57 +0000 (+0000) Subject: Always initialize NEXT_CATCH; fixes a Valgrind uninitialized read error X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0613c37d7914672585e67bedd18d9a1588104360;p=clang Always initialize NEXT_CATCH; fixes a Valgrind uninitialized read error (originally reported in PR1682). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51551 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index 6d8ebcf864..f89e2f40fa 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -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(atCatchList); while (ObjCAtCatchStmt* NextCatch = AtCatchList->getNextCatchStmt())