From f6055806d4a6a39c49c441215a9a5d3a8e933de0 Mon Sep 17 00:00:00 2001 From: Torok Edwin Date: Sat, 3 May 2008 20:25:26 +0000 Subject: [PATCH] Implement destructor for PostDominatorTree to eliminate a memory leak. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50607 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/PostDominators.h | 2 ++ lib/Analysis/PostDominators.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index 07910e9538c..27c2b26c8c2 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -29,6 +29,8 @@ struct PostDominatorTree : public FunctionPass { DT = new DominatorTreeBase(true); } + ~PostDominatorTree(); + virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp index 4330e9039d1..c72b140a622 100644 --- a/lib/Analysis/PostDominators.cpp +++ b/lib/Analysis/PostDominators.cpp @@ -37,6 +37,11 @@ bool PostDominatorTree::runOnFunction(Function &F) { return false; } +PostDominatorTree::~PostDominatorTree() +{ + delete DT; +} + //===----------------------------------------------------------------------===// // PostDominanceFrontier Implementation //===----------------------------------------------------------------------===//