clang/lib/Analysis/CFG.cpp: Fix memory leak since r153297.

evaluateAsBooleanConditionNoCache(S) might update the map and invalidate the iterator.

llvm-svn: 153406
This commit is contained in:
NAKAMURA Takumi 2012-03-25 06:30:32 +00:00
parent 2121199241
commit f0434b09fc
1 changed files with 5 additions and 2 deletions

View File

@ -457,8 +457,11 @@ private:
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;
}
}