[cfe-commits] r41848 - /cfe/trunk/Analysis/DeadStores.cpp
Ted Kremenek
kremenek at apple.com
Tue Sep 11 10:00:40 PDT 2007
Author: kremenek
Date: Tue Sep 11 12:00:40 2007
New Revision: 41848
URL: http://llvm.org/viewvc/llvm-project?rev=41848&view=rev
Log:
Fixed potential NULL dereference when iterating over a chain of Decls.
Modified:
cfe/trunk/Analysis/DeadStores.cpp
Modified: cfe/trunk/Analysis/DeadStores.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/DeadStores.cpp?rev=41848&r1=41847&r2=41848&view=diff
==============================================================================
--- cfe/trunk/Analysis/DeadStores.cpp (original)
+++ cfe/trunk/Analysis/DeadStores.cpp Tue Sep 11 12:00:40 2007
@@ -50,7 +50,7 @@
// 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();
More information about the cfe-commits
mailing list