From 27a00b64ba22ca7bcd701a94263a67634323bd56 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Tue, 21 Mar 2023 07:34:40 -0700 Subject: [PATCH] Fixed CeContext leak --- IDEHelper/Compiler/BfModuleTypeUtils.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/IDEHelper/Compiler/BfModuleTypeUtils.cpp b/IDEHelper/Compiler/BfModuleTypeUtils.cpp index 9fb24a6c..19afcbe7 100644 --- a/IDEHelper/Compiler/BfModuleTypeUtils.cpp +++ b/IDEHelper/Compiler/BfModuleTypeUtils.cpp @@ -2456,6 +2456,7 @@ void BfModule::HandleCEAttributes(CeEmitContext* ceEmitContext, BfTypeInstance* SetAndRestoreValue prevEmitContext(mCompiler->mCeMachine->mCurEmitContext, ceEmitContext); auto ceContext = mCompiler->mCeMachine->AllocContext(); + defer({ mCompiler->mCeMachine->ReleaseContext(ceContext); }); BfIRValue attrVal =ceContext->CreateAttribute(customAttribute.mRef, this, typeInstance->mConstHolder, &customAttribute); for (int baseIdx = 0; baseIdx < checkDepth; baseIdx++) @@ -2592,8 +2593,6 @@ void BfModule::HandleCEAttributes(CeEmitContext* ceEmitContext, BfTypeInstance* UpdateCEEmit(ceEmitContext, typeInstance, customAttribute.mDeclaringType, ctxStr, customAttribute.mRef, BfCeTypeEmitSourceKind_Type); } } - - mCompiler->mCeMachine->ReleaseContext(ceContext); } }