From 9a23968fdacc0df4ec7066bc19a412f8b7a8bd69 Mon Sep 17 00:00:00 2001 From: Zhenwei Jin <109658203+kylo5aby@users.noreply.github.com> Date: Wed, 21 Jan 2026 11:02:33 +0800 Subject: [PATCH] Fix potential memory leak when discarding FreeMachineFunction (#4796) Signed-off-by: zhenweijin --- core/iwasm/compilation/aot_orc_extra2.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/core/iwasm/compilation/aot_orc_extra2.cpp b/core/iwasm/compilation/aot_orc_extra2.cpp index 180e54050..6bcfb786b 100644 --- a/core/iwasm/compilation/aot_orc_extra2.cpp +++ b/core/iwasm/compilation/aot_orc_extra2.cpp @@ -85,6 +85,7 @@ MyPassManager::add(llvm::Pass *P) // a hack to avoid having a copy of the whole addPassesToEmitMC. // we want to add PrintStackSizes before FreeMachineFunctionPass. if (P->getPassName() == "Free MachineFunction") { + delete P; return; } llvm::legacy::PassManager::add(P);