[cfe-commits] r153406 - /cfe/trunk/lib/Analysis/CFG.cpp
NAKAMURA Takumi
geek4civic at gmail.com
Sat Mar 24 23:30:32 PDT 2012
Author: chapuni
Date: Sun Mar 25 01:30:32 2012
New Revision: 153406
URL: http://llvm.org/viewvc/llvm-project?rev=153406&view=rev
Log:
clang/lib/Analysis/CFG.cpp: Fix memory leak since r153297.
evaluateAsBooleanConditionNoCache(S) might update the map and invalidate the iterator.
Modified:
cfe/trunk/lib/Analysis/CFG.cpp
Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=153406&r1=153405&r2=153406&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Sun Mar 25 01:30:32 2012
@@ -457,8 +457,11 @@
CachedBoolEvals.insert(std::make_pair(S, TryResult()));
if (!Inserted)
return I->second; // already in map;
-
- return (I->second = evaluateAsBooleanConditionNoCache(S));
+
+ // Retrieve result at first, or the map might be updated.
+ TryResult Result = evaluateAsBooleanConditionNoCache(S);
+ CachedBoolEvals[S] = Result; // update or insert
+ return Result;
}
}
More information about the cfe-commits
mailing list