diff options
author | Kevin Enderby <enderby@apple.com> | 2010-12-10 01:41:56 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2010-12-10 01:41:56 +0000 |
commit | 44a9e8f869dd9d04a04eb556ff0ff4a1039d371f (patch) | |
tree | 521a4396d20c3845a5d8891662864df764f744c1 /lib | |
parent | 031d30781acaecb58f64a7b480818a219594e99f (diff) | |
download | llvm-44a9e8f869dd9d04a04eb556ff0ff4a1039d371f.tar.gz llvm-44a9e8f869dd9d04a04eb556ff0ff4a1039d371f.tar.bz2 llvm-44a9e8f869dd9d04a04eb556ff0ff4a1039d371f.tar.xz |
Fix the leak from r121401 of the Operands erased in the list but not deleted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121450 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index d0d2368aab..c21a07c7d0 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -962,8 +962,11 @@ MatchAndEmitInstruction(SMLoc IDLoc, MatchResult2 = MatchInstructionImpl(Operands, Inst, ErrorInfo); if (MatchResult2 == Match_Success) MatchResult = Match_Success; - else + else { + ARMOperand *CCOut = ((ARMOperand*)Operands[1]); Operands.erase(Operands.begin() + 1); + delete CCOut; + } } // If we get a Match_MnemonicFail it might be some arithmetic instruction // that updates the condition codes if it ends in 's'. So see if the @@ -976,8 +979,10 @@ MatchAndEmitInstruction(SMLoc IDLoc, // removed the 's' from the mnemonic for matching. StringRef MnemonicNoS = Mnemonic.slice(0, Mnemonic.size() - 1); SMLoc NameLoc = ((ARMOperand*)Operands[0])->getStartLoc(); - Operands.erase(Operands.begin()); - Operands.insert(Operands.begin(), + ARMOperand *OldMnemonic = ((ARMOperand*)Operands[0]); + Operands.erase(Operands.begin()); + delete OldMnemonic; + Operands.insert(Operands.begin(), ARMOperand::CreateToken(MnemonicNoS, NameLoc)); Operands.insert(Operands.begin() + 1, ARMOperand::CreateCCOut(ARM::CPSR, NameLoc)); @@ -985,10 +990,14 @@ MatchAndEmitInstruction(SMLoc IDLoc, if (MatchResult2 == Match_Success) MatchResult = Match_Success; else { - Operands.erase(Operands.begin()); - Operands.insert(Operands.begin(), + ARMOperand *OldMnemonic = ((ARMOperand*)Operands[0]); + Operands.erase(Operands.begin()); + delete OldMnemonic; + Operands.insert(Operands.begin(), ARMOperand::CreateToken(Mnemonic, NameLoc)); - Operands.erase(Operands.begin() + 1); + ARMOperand *CCOut = ((ARMOperand*)Operands[1]); + Operands.erase(Operands.begin() + 1); + delete CCOut; } } } |