]> granicus.if.org Git - clang/commitdiff
Fix a leak found by LSan: ConsumedBlockInfo owns its StateMapsArray entries.
authorNico Weber <nicolasweber@gmx.de>
Tue, 6 May 2014 17:18:03 +0000 (17:18 +0000)
committerNico Weber <nicolasweber@gmx.de>
Tue, 6 May 2014 17:18:03 +0000 (17:18 +0000)
(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.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208108 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/Analyses/Consumed.h

index 7550ddf80eb3c6132d7a2686acff8fc77cd806ab..3c9ba78548be87d83804fa1d724d0289aa5e239e 100644 (file)
@@ -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;