From: Craig Topper Date: Fri, 6 May 2016 06:56:14 +0000 (+0000) Subject: [TableGen] Fix a memory leak when creating SwitchOpcodeMatchers. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=886b4ecfe7100f9056de7192aa2e67ec98b8884f;p=llvm [TableGen] Fix a memory leak when creating SwitchOpcodeMatchers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268712 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/TableGen/DAGISelMatcherOpt.cpp b/utils/TableGen/DAGISelMatcherOpt.cpp index e17e27a2be4..ad385fac043 100644 --- a/utils/TableGen/DAGISelMatcherOpt.cpp +++ b/utils/TableGen/DAGISelMatcherOpt.cpp @@ -383,7 +383,8 @@ static void FactorNodes(std::unique_ptr &MatcherPtr) { CheckOpcodeMatcher *COM = cast(NewOptionsToMatch[i]); assert(Opcodes.insert(COM->getOpcode().getEnumName()).second && "Duplicate opcodes not factored?"); - Cases.push_back(std::make_pair(&COM->getOpcode(), COM->getNext())); + Cases.push_back(std::make_pair(&COM->getOpcode(), COM->takeNext())); + delete COM; } MatcherPtr.reset(new SwitchOpcodeMatcher(Cases));