[PATCH] D32243: Fix a leak in tools/driver/cc1as_main.cpp
Kostya Serebryany via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 19 14:05:59 PDT 2017
kcc created this revision.
For some reason, the asan bot has recently started reporting this leak even though it existed for ages.
https://reviews.llvm.org/D32243
Files:
tools/driver/cc1as_main.cpp
Index: tools/driver/cc1as_main.cpp
===================================================================
--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -506,12 +506,12 @@
// 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32243.95815.patch
Type: text/x-patch
Size: 786 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170419/4a79b4bd/attachment-0001.bin>
More information about the cfe-commits
mailing list