From 589e7ecc89ab442e83703fa572ef046946c01df1 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 3 May 2014 08:39:35 +0000 Subject: [PATCH] [leaks] Don't leak the fake arguments we synthesize for LLVM option parsing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207899 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/FrontendTool/ExecuteCompilerInvocation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 0edd5770f1..3d7a83d4b3 100644 --- a/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -212,12 +212,12 @@ bool clang::ExecuteCompilerInvocation(CompilerInstance *Clang) { // This should happen AFTER plugins have been loaded! if (!Clang->getFrontendOpts().LLVMArgs.empty()) { unsigned NumArgs = Clang->getFrontendOpts().LLVMArgs.size(); - const char **Args = new const char*[NumArgs + 2]; + auto Args = llvm::make_unique(NumArgs + 2); Args[0] = "clang (LLVM option parsing)"; for (unsigned i = 0; i != NumArgs; ++i) Args[i + 1] = Clang->getFrontendOpts().LLVMArgs[i].c_str(); Args[NumArgs + 1] = 0; - llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args); + llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args.get()); } #ifdef CLANG_ENABLE_STATIC_ANALYZER -- 2.40.0