[PATCH] D147993: Add delete to fix resource leak in llc.cpp

Wang, Xin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 11 23:50:56 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG3657e7777f20: Add delete to fix resource leak in llc.cpp (authored by XinWang10).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147993/new/

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.512665.patch
Type: text/x-patch
Size: 787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230412/66e168f2/attachment.bin>


More information about the llvm-commits mailing list