From: Ted Kremenek Date: Tue, 11 Sep 2007 17:00:40 +0000 (+0000) Subject: Fixed potential NULL dereference when iterating over a chain of Decls. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a596533c986e33363db80a00fb4139ea2e03ca63;p=clang Fixed potential NULL dereference when iterating over a chain of Decls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41848 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Analysis/DeadStores.cpp b/Analysis/DeadStores.cpp index a9a42a8e18..e547989f6b 100644 --- a/Analysis/DeadStores.cpp +++ b/Analysis/DeadStores.cpp @@ -50,7 +50,7 @@ public: // Iterate through the decls. Warn if any of them (which have // initializers) are not live. for (VarDecl* V = cast(DS->getDecl()); V != NULL ; - V = cast(V->getNextDeclarator())) + V = cast_or_null(V->getNextDeclarator())) if (Expr* E = V->getInit()) if (!L.isLive(Live,V)) { SourceRange R = E->getSourceRange();