From 5a3fe49fc57ed6e7794e47f5ddf2acded4ba3cd5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksey=20Kliger=20=28=CE=BBgeek=29?= Date: Tue, 5 Apr 2022 07:57:07 -0400 Subject: [PATCH] [2020-02][cominterop] Fix CCW memory leak (#21453) Free the method builder after compiling the wrapper. This is already fixed on mono/mono `main` as part of the refactoring in https://github.com/mono/mono/pull/19768 (And that change was also propagated to dotnet/runtime) --- mono/metadata/cominterop.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mono/metadata/cominterop.c b/mono/metadata/cominterop.c index d0e2241063c..4396617a9c5 100644 --- a/mono/metadata/cominterop.c +++ b/mono/metadata/cominterop.c @@ -2284,6 +2284,7 @@ cominterop_get_ccw_checked (MonoObjectHandle object, MonoClass* itf, MonoError * vtable [vtable_index--] = mono_compile_method_checked (wrapper_method, error); + mono_mb_free (mb); // cleanup, then error out if compile_method failed for (param_index = sig_adjusted->param_count; param_index >= 0; param_index--) if (mspecs [param_index]) -- 2.11.4.GIT