[PATCH] D148003: draft fix

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


XinWang10 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
XinWang10 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148003

Files:
  llvm/lib/CodeGen/LLVMTargetMachine.cpp


Index: llvm/lib/CodeGen/LLVMTargetMachine.cpp
===================================================================
--- llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -277,8 +277,13 @@
   MCCodeEmitter *MCE = getTarget().createMCCodeEmitter(*getMCInstrInfo(), *Ctx);
   MCAsmBackend *MAB =
       getTarget().createMCAsmBackend(STI, MRI, Options.MCOptions);
-  if (!MCE || !MAB)
+  if (!MCE || !MAB) {
+    if (MCE)
+      delete MCE;
+    if (MAB)
+      delete MAB;
     return true;
+  }
 
   const Triple &T = getTargetTriple();
   std::unique_ptr<MCStreamer> AsmStreamer(getTarget().createMCObjectStreamer(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148003.512384.patch
Type: text/x-patch
Size: 648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230411/12881457/attachment.bin>


More information about the llvm-commits mailing list