[llvm] Fix memory leak in LLVMTargetMachine.cpp (PR #109610)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 22 22:43:19 PDT 2024
https://github.com/abhishek-kaushik22 created https://github.com/llvm/llvm-project/pull/109610
None
>From 586aa68f8b1cfc9805349320205575bfb8fab5da Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Mon, 23 Sep 2024 11:12:45 +0530
Subject: [PATCH] Fix memory leak in LLVMTargetMachine.cpp
---
llvm/lib/CodeGen/LLVMTargetMachine.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index d0dfafeaef561f..f7335de116e1f7 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -259,9 +259,11 @@ bool LLVMTargetMachine::addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx,
const MCRegisterInfo &MRI = *getMCRegisterInfo();
std::unique_ptr<MCCodeEmitter> MCE(
getTarget().createMCCodeEmitter(*getMCInstrInfo(), *Ctx));
+ if (!MCE)
+ return true;
MCAsmBackend *MAB =
getTarget().createMCAsmBackend(STI, MRI, Options.MCOptions);
- if (!MCE || !MAB)
+ if (!MAB)
return true;
const Triple &T = getTargetTriple();
More information about the llvm-commits
mailing list