diff options
author | Tom Care <tom.care@uqconnect.edu.au> | 2012-05-31 21:24:58 +0000 |
---|---|---|
committer | Tom Care <tom.care@uqconnect.edu.au> | 2012-05-31 21:24:58 +0000 |
commit | 698daefb589c931073b6942f59516a1e1e6c2300 (patch) | |
tree | 5218933f75b786a3c20fc6821391924002f11749 /clang/lib | |
parent | d35440542690cc3ea0d821abab794b9b15a986ee (diff) | |
download | bcm5719-llvm-698daefb589c931073b6942f59516a1e1e6c2300.tar.gz bcm5719-llvm-698daefb589c931073b6942f59516a1e1e6c2300.zip |
[analyzer] Fix BugType memory leak in IdempotentOperationChecker.
llvm-svn: 157772
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp index c08f163a1f7..9d0b83f40b3 100644 --- a/clang/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp @@ -106,6 +106,7 @@ private: typedef llvm::DenseMap<const BinaryOperator *, BinaryOperatorData> AssumptionMap; mutable AssumptionMap hash; + mutable OwningPtr<BugType> BT; }; } @@ -343,7 +344,9 @@ void IdempotentOperationChecker::checkPostStmt(const BinaryOperator *B, void IdempotentOperationChecker::checkEndAnalysis(ExplodedGraph &G, BugReporter &BR, ExprEngine &Eng) const { - BugType *BT = new BugType("Idempotent operation", "Dead code"); + if (!BT) + BT.reset(new BugType("Idempotent operation", "Dead code")); + // Iterate over the hash to see if we have any paths with definite // idempotent operations. for (AssumptionMap::const_iterator i = hash.begin(); i != hash.end(); ++i) { |