[WebAssembly] Fix memory leak on WasmEHFuncInfo
authorHeejin Ahn <aheejin@gmail.com>
Fri, 28 Sep 2018 20:54:04 +0000 (20:54 +0000)
committerHeejin Ahn <aheejin@gmail.com>
Fri, 28 Sep 2018 20:54:04 +0000 (20:54 +0000)
Summary: WasmEHFuncInfo objects were not being properly deleted.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D52582

llvm-svn: 343362

llvm/lib/CodeGen/MachineFunction.cpp

index ecf913f..8603a1e 100644 (file)
@@ -246,6 +246,11 @@ void MachineFunction::clear() {
     WinEHInfo->~WinEHFuncInfo();
     Allocator.Deallocate(WinEHInfo);
   }
+
+  if (WasmEHInfo) {
+    WasmEHInfo->~WasmEHFuncInfo();
+    Allocator.Deallocate(WasmEHInfo);
+  }
 }
 
 const DataLayout &MachineFunction::getDataLayout() const {