Skip to content

Commit

Permalink
[release/7.0-staging] Fix a memory leak in runtime interop stubs when…
Browse files Browse the repository at this point in the history
… using an array of structs of types that use old-style managed marshalers (#93148)

Co-authored-by: Jeremy Koritzinsky <[email protected]>
  • Loading branch information
github-actions[bot] and jkoritzinsky authored Oct 9, 2023
1 parent 7ee35b9 commit be8f744
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/coreclr/vm/ilmarshalers.h
Original file line number Diff line number Diff line change
Expand Up @@ -3138,39 +3138,13 @@ class ILMngdMarshaler : public ILMarshaler
void EmitClearNative(ILCodeStream* pslILEmit) override
{
WRAPPER_NO_CONTRACT;
ILCodeLabel* pNoManagedValueLabel = nullptr;
if (IsFieldMarshal(m_dwMarshalFlags))
{
pNoManagedValueLabel = pslILEmit->NewCodeLabel();
pslILEmit->EmitLDARG(StructMarshalStubs::MANAGED_STRUCT_ARGIDX);
pslILEmit->EmitBRFALSE(pNoManagedValueLabel);
}

EmitCallMngdMarshalerMethod(pslILEmit, GetClearNativeMethod());

if (IsFieldMarshal(m_dwMarshalFlags))
{
pslILEmit->EmitLabel(pNoManagedValueLabel);
}
}

void EmitClearNativeContents(ILCodeStream* pslILEmit) override
{
WRAPPER_NO_CONTRACT;
ILCodeLabel* pNoManagedValueLabel = nullptr;
if (IsFieldMarshal(m_dwMarshalFlags))
{
pNoManagedValueLabel = pslILEmit->NewCodeLabel();
pslILEmit->EmitLDARG(StructMarshalStubs::MANAGED_STRUCT_ARGIDX);
pslILEmit->EmitBRFALSE(pNoManagedValueLabel);
}

EmitCallMngdMarshalerMethod(pslILEmit, GetClearNativeContentsMethod());

if (IsFieldMarshal(m_dwMarshalFlags))
{
pslILEmit->EmitLabel(pNoManagedValueLabel);
}
}

bool NeedsClearCLR() override
Expand Down

0 comments on commit be8f744

Please sign in to comment.