From eed4f2a6c54f2a9acf9175eb24cad966c21127e9 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 26 Dec 2011 14:18:37 +0000 Subject: [PATCH] Fix potential use after free. llvm-svn: 147277 --- clang/lib/Driver/Tools.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 883899d45b61..41ff1102bfc8 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -800,9 +800,8 @@ void Clang::AddSparcTargetArgs(const ArgList &Args, const Driver &D = getToolChain().getDriver(); if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) { - StringRef MArch = A->getValue(Args); CmdArgs.push_back("-target-cpu"); - CmdArgs.push_back(MArch.str().c_str()); + CmdArgs.push_back(A->getValue(Args)); } // Select the float ABI as determined by -msoft-float, -mhard-float, and