r208108 - Fix a leak found by LSan: ConsumedBlockInfo owns its StateMapsArray entries.
Nico Weber
nicolasweber at gmx.de
Tue May 6 10:18:03 PDT 2014
Author: nico
Date: Tue May 6 12:18:03 2014
New Revision: 208108
URL: http://llvm.org/viewvc/llvm-project?rev=208108&view=rev
Log:
Fix a leak found by LSan: ConsumedBlockInfo owns its StateMapsArray entries.
(I tried converting StateMapsArray to a vector<unique_ptr> and changing the
types of getInfo() and addInfo() to take unique_ptrs. This mostly worked,
except for the three-argument form of addInfo() which I found confusing enough
that I went with this simpler fix for now.)
Modified:
cfe/trunk/include/clang/Analysis/Analyses/Consumed.h
Modified: cfe/trunk/include/clang/Analysis/Analyses/Consumed.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/Consumed.h?rev=208108&r1=208107&r2=208108&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/Consumed.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/Consumed.h Tue May 6 12:18:03 2014
@@ -201,7 +201,8 @@ namespace consumed {
public:
ConsumedBlockInfo() { }
-
+ ~ConsumedBlockInfo() { llvm::DeleteContainerPointers(StateMapsArray); }
+
ConsumedBlockInfo(unsigned int NumBlocks, PostOrderCFGView *SortedGraph)
: StateMapsArray(NumBlocks, nullptr), VisitOrder(NumBlocks, 0) {
unsigned int VisitOrderCounter = 0;
More information about the cfe-commits
mailing list