From: Aaron Ballman Date: Thu, 17 Apr 2014 15:23:50 +0000 (+0000) Subject: Since the object is new'ed in the enterCFG function, now deleting in the exitCFG... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ae2588a1705dbf47551636e766d445be12797d4;p=clang Since the object is new'ed in the enterCFG function, now deleting in the exitCFG function instead of the destructor to ensure proper pairing. This allows reuse of the builder without creating a memory leak. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206471 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/Analyses/ThreadSafetyCommon.h b/include/clang/Analysis/Analyses/ThreadSafetyCommon.h index 994af713f6..cff0781666 100644 --- a/include/clang/Analysis/Analyses/ThreadSafetyCommon.h +++ b/include/clang/Analysis/Analyses/ThreadSafetyCommon.h @@ -227,10 +227,6 @@ public: SelfVar = new (Arena)til::Variable(til::Variable::VK_SFun); } - ~SExprBuilder() { - delete CallCtx; - } - // Translate a clang statement or expression to a TIL expression. // Also performs substitution of variables; Ctx provides the context. // Dispatches on the type of S. diff --git a/lib/Analysis/ThreadSafetyCommon.cpp b/lib/Analysis/ThreadSafetyCommon.cpp index 2c90b2a4be..02c9e8dc03 100644 --- a/lib/Analysis/ThreadSafetyCommon.cpp +++ b/lib/Analysis/ThreadSafetyCommon.cpp @@ -597,6 +597,7 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) { CurrentBlockID = 0; CurrentVarID = 0; CurrentArgIndex = 0; + delete CallCtx; }