From 3e20cabd277d64d9b6bb0f37accdbd3313ef504c Mon Sep 17 00:00:00 2001 From: Jay Krell Date: Fri, 16 Aug 2019 06:33:04 -0700 Subject: [PATCH] Ignore NULL in mono_marshal_free_dynamic_wrappers and mono_free_method. (mono/mono#14150) Commit migrated from https://github.com/mono/mono/commit/e54f03168d223debdab1717eb24055662211e4f8 --- src/mono/mono/metadata/loader.c | 3 +++ src/mono/mono/metadata/marshal.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/mono/mono/metadata/loader.c b/src/mono/mono/metadata/loader.c index c8d20fa..e093615 100644 --- a/src/mono/mono/metadata/loader.c +++ b/src/mono/mono/metadata/loader.c @@ -2194,6 +2194,9 @@ mono_get_method_constrained_checked (MonoImage *image, guint32 token, MonoClass void mono_free_method (MonoMethod *method) { + if (!method) + return; + MONO_PROFILER_RAISE (method_free, (method)); /* FIXME: This hack will go away when the profiler will support freeing methods */ diff --git a/src/mono/mono/metadata/marshal.c b/src/mono/mono/metadata/marshal.c index ae80fff..2099318 100644 --- a/src/mono/mono/metadata/marshal.c +++ b/src/mono/mono/metadata/marshal.c @@ -6338,6 +6338,9 @@ clear_runtime_invoke_method_cache (GHashTable *table, MonoMethod *method) void mono_marshal_free_dynamic_wrappers (MonoMethod *method) { + if (!method) + return; + MonoImage *image = get_method_image (method); g_assert (method_is_dynamic (method)); -- 2.7.4