From: Nico Weber Date: Sun, 11 May 2014 17:27:13 +0000 (+0000) Subject: Driver: Don't leak the -Xarch argument when its use is incorrect. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d0886e36696324b4e737dc74a058acda7bffd44;p=clang Driver: Don't leak the -Xarch argument when its use is incorrect. (LLVM's lib/Option looks like it might appreciate being hit with the std::unique_ptr stick.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208505 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 8e3d6d6d95..0b77ee0c7b 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -694,7 +694,7 @@ DerivedArgList *MachO::TranslateArgs(const DerivedArgList &Args, Arg *OriginalArg = A; unsigned Index = Args.getBaseArgs().MakeIndex(A->getValue(1)); unsigned Prev = Index; - Arg *XarchArg = Opts.ParseOneArg(Args, Index); + std::unique_ptr XarchArg(Opts.ParseOneArg(Args, Index)); // If the argument parsing failed or more than one argument was // consumed, the -Xarch_ argument's parameter tried to consume @@ -715,8 +715,8 @@ DerivedArgList *MachO::TranslateArgs(const DerivedArgList &Args, } XarchArg->setBaseArg(A); - A = XarchArg; + A = XarchArg.release(); DAL->AddSynthesizedArg(A); // Linker input arguments require custom handling. The problem is that we