summaryrefslogtreecommitdiffstats
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
commit5af4515788840c5eed5c94fcb6542cdef74e04b2 (patch)
tree9d124d33605ee96767d9ef655cfadcd0336126b6
parent4a48623e4f7a6dc1ab0d5889b01c2cbd5a430655 (diff)
downloadbcm5719-llvm-5af4515788840c5eed5c94fcb6542cdef74e04b2.tar.gz
bcm5719-llvm-5af4515788840c5eed5c94fcb6542cdef74e04b2.zip
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 llvm-svn: 300755
-rw-r--r--clang/tools/driver/cc1as_main.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index 2fa8edb81ae..33d957658cf 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud