[PATCH] D147993: draft for fix resource leak in llc
Wang, Xin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 10 22:23:53 PDT 2023
XinWang10 created this revision.
Herald added a project: All.
XinWang10 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
draft
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147993
Files:
llvm/tools/llc/llc.cpp
Index: llvm/tools/llc/llc.cpp
===================================================================
--- llvm/tools/llc/llc.cpp
+++ llvm/tools/llc/llc.cpp
@@ -699,13 +699,17 @@
if (!MIR) {
WithColor::warning(errs(), argv[0])
<< "run-pass is for .mir file only.\n";
+ delete MMIWP;
return 1;
}
- TargetPassConfig &TPC = *LLVMTM.createPassConfig(PM);
+ TargetPassConfig *PTPC = LLVMTM.createPassConfig(PM);
+ TargetPassConfig &TPC = *PTPC;
if (TPC.hasLimitedCodeGenPipeline()) {
WithColor::warning(errs(), argv[0])
<< "run-pass cannot be used with "
<< TPC.getLimitedCodeGenPipelineReason(" and ") << ".\n";
+ delete PTPC;
+ delete MMIWP;
return 1;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147993.512339.patch
Type: text/x-patch
Size: 787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230411/70cf1c41/attachment.bin>
More information about the llvm-commits
mailing list