1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixed CeContext leak

This commit is contained in:
Brian Fiete 2023-03-21 07:34:40 -07:00
parent ef9464900e
commit 27a00b64ba

View file

@ -2456,6 +2456,7 @@ void BfModule::HandleCEAttributes(CeEmitContext* ceEmitContext, BfTypeInstance*
SetAndRestoreValue<CeEmitContext*> 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);
}
}