X86AsmParser.cpp: Fix memory leak at replacing movsd to movsl.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 23 Apr 2014 14:51:35 +0000 (14:51 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 23 Apr 2014 14:51:35 +0000 (14:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206991 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmParser/X86AsmParser.cpp

index 9f3eea300a73e043de2cc69ba104c4ff69ad9c4a..c5fdc2a2b4186a8a0969413010961e6abe8c5bd5 100644 (file)
@@ -2073,8 +2073,10 @@ ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc,
       (Name == "smov" || Name == "smovb" || Name == "smovw" ||
        Name == "smovl" || Name == "smovd" || Name == "smovq"))) {
     if (Operands.size() == 1) {
-      if (Name == "movsd")
+      if (Name == "movsd") {
+        delete Operands.back();
         Operands.back() = X86Operand::CreateToken("movsl", NameLoc);
+      }
       if (isParsingIntelSyntax()) {
         Operands.push_back(DefaultMemDIOperand(NameLoc));
         Operands.push_back(DefaultMemSIOperand(NameLoc));