From: Nico Weber Date: Wed, 23 Apr 2014 19:19:20 +0000 (+0000) Subject: Fix a memory leak found by LSan. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f035b1e0f6b37a2abe56ab36d2ac8683d845bf6a;p=clang Fix a memory leak found by LSan. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207013 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index bcd9598b31..166f403efb 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -26,6 +26,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCInstPrinter.h" #include "llvm/MC/MCObjectFileInfo.h" #include "llvm/MC/MCParser/MCAsmParser.h" #include "llvm/MC/MCRegisterInfo.h" @@ -2197,8 +2198,8 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { std::unique_ptr TargetParser( TheTarget->createMCAsmParser(*STI, *Parser, *MII, MCOptions)); - llvm::MCInstPrinter *IP = - TheTarget->createMCInstPrinter(1, *MAI, *MII, *MRI, *STI); + std::unique_ptr IP( + TheTarget->createMCInstPrinter(1, *MAI, *MII, *MRI, *STI)); // Change to the Intel dialect. Parser->setAssemblerDialect(1); @@ -2220,7 +2221,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { SmallVector Clobbers; if (Parser->parseMSInlineAsm(AsmLoc.getPtrEncoding(), AsmStringIR, NumOutputs, NumInputs, OpExprs, Constraints, - Clobbers, MII, IP, Callback)) + Clobbers, MII, IP.get(), Callback)) return StmtError(); // Filter out "fpsw". Clang doesn't accept it, and it always lists flags and