From: Nico Weber Date: Tue, 6 May 2014 17:18:03 +0000 (+0000) Subject: Fix a leak found by LSan: ConsumedBlockInfo owns its StateMapsArray entries. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae8a33daa177532359f65794dea183846f5b8367;p=clang Fix a leak found by LSan: ConsumedBlockInfo owns its StateMapsArray entries. (I tried converting StateMapsArray to a vector 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 --- diff --git a/include/clang/Analysis/Analyses/Consumed.h b/include/clang/Analysis/Analyses/Consumed.h index 7550ddf80e..3c9ba78548 100644 --- a/include/clang/Analysis/Analyses/Consumed.h +++ b/include/clang/Analysis/Analyses/Consumed.h @@ -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;