summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-04-19 20:57:13 +0000
committerKostya Serebryany <kcc@google.com>2017-04-19 20:57:13 +0000
commitf8562bd6ceeff06973cf4519b79e10b900e0752d (patch)
treef50adb9edadfb196082815954a1e5211647101a0 /tools
parent665a836fa20a3ba5a1083f5d6e7f2b9a5360a730 (diff)
downloadclang-f8562bd6ceeff06973cf4519b79e10b900e0752d.tar.gz
Fix a leak in tools/driver/cc1as_main.cpp
Summary: For some reason, the asan bot has recently started reporting this leak even though it existed for ages. Reviewers: pcc Reviewed By: pcc Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D32243 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/driver/cc1as_main.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp
index 2fa8edb81a..33d957658c 100644
--- a/tools/driver/cc1as_main.cpp
+++ b/tools/driver/cc1as_main.cpp
@@ -506,12 +506,12 @@ int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
// FIXME: Remove this, one day.
if (!Asm.LLVMArgs.empty()) {
unsigned NumArgs = Asm.LLVMArgs.size();
- const char **Args = new const char*[NumArgs + 2];
+ auto Args = llvm::make_unique<const char*[]>(NumArgs + 2);
Args[0] = "clang (LLVM option parsing)";
for (unsigned i = 0; i != NumArgs; ++i)
Args[i + 1] = Asm.LLVMArgs[i].c_str();
Args[NumArgs + 1] = nullptr;
- llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args);
+ llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args.get());
}
// Execute the invocation, unless there were parsing errors.