Просмотр исходного кода

Fix potential memory leak when discarding FreeMachineFunction (#4796)

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>
Zhenwei Jin 5 дней назад
Родитель
Сommit
9a23968fda
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      core/iwasm/compilation/aot_orc_extra2.cpp

+ 1 - 0
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);