summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-09-11 17:00:40 +0000
committerTed Kremenek <kremenek@apple.com>2007-09-11 17:00:40 +0000
commitca6c2b750b738753a7f46cde26e9448217abe8fc (patch)
tree4b9fc35bb0329ace27ca4e41e8f8e4df87698e20
parent412af03cee1e45b14b85d46914bf3103067f31d5 (diff)
downloadbcm5719-llvm-ca6c2b750b738753a7f46cde26e9448217abe8fc.tar.gz
bcm5719-llvm-ca6c2b750b738753a7f46cde26e9448217abe8fc.zip
Fixed potential NULL dereference when iterating over a chain of Decls.
llvm-svn: 41848
-rw-r--r--clang/Analysis/DeadStores.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/Analysis/DeadStores.cpp b/clang/Analysis/DeadStores.cpp
index a9a42a8e18f..e547989f6b8 100644
--- a/clang/Analysis/DeadStores.cpp
+++ b/clang/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<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();
OpenPOWER on IntegriCloud