]> granicus.if.org Git - clang/commitdiff
Fixed potential NULL dereference when iterating over a chain of Decls.
authorTed Kremenek <kremenek@apple.com>
Tue, 11 Sep 2007 17:00:40 +0000 (17:00 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 11 Sep 2007 17:00:40 +0000 (17:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41848 91177308-0d34-0410-b5e6-96231b3b80d8

Analysis/DeadStores.cpp

index a9a42a8e18fda8c5e0d59a486dda514648a59048..e547989f6b8bff12c05c98bf6ef9b5fb4cf0349f 100644 (file)
@@ -50,7 +50,7 @@ public:
       // Iterate through the decls.  Warn if any of them (which have
       // initializers) are not live.
       for (VarDecl* V = cast<VarDecl>(DS->getDecl()); V != NULL ; 
-                    V = cast<VarDecl>(V->getNextDeclarator()))
+                    V = cast_or_null<VarDecl>(V->getNextDeclarator()))
         if (Expr* E = V->getInit())
           if (!L.isLive(Live,V)) {
             SourceRange R = E->getSourceRange();