Ignore NULL in mono_marshal_free_dynamic_wrappers and mono_free_method. (mono/mono...
authorJay Krell <jaykrell@microsoft.com>
Fri, 16 Aug 2019 13:33:04 +0000 (06:33 -0700)
committerJo Shields <joshield@microsoft.com>
Fri, 16 Aug 2019 13:33:04 +0000 (09:33 -0400)
Commit migrated from https://github.com/mono/mono/commit/e54f03168d223debdab1717eb24055662211e4f8

src/mono/mono/metadata/loader.c
src/mono/mono/metadata/marshal.c

index c8d20fa..e093615 100644 (file)
@@ -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 */
index ae80fff..2099318 100644 (file)
@@ -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));