Fix a GC crash happening in full AOT compiled code where a delegate method can't
authorlateralusX <lateralusx.github@gmail.com>
Thu, 14 Jul 2016 11:51:11 +0000 (13:51 +0200)
committerlateralusX <lateralusx.github@gmail.com>
Thu, 14 Jul 2016 17:34:52 +0000 (19:34 +0200)
be detected at runtime. Since the process crash, lot of valuable information was never
written out to the console (like the managed stack trace) needed to effectively resolve
the issue.

mono/metadata/marshal.c

index 3edf257bee53630bcae260331657d73c757d2a3a..bf13ae434eb2123aee229ab4d30b90f541d8b872 100644 (file)
@@ -422,7 +422,8 @@ mono_delegate_to_ftnptr (MonoDelegate *delegate)
        return delegate->delegate_trampoline;
 
 fail:
-       mono_gchandle_free (target_handle);
+       if (target_handle != 0)
+               mono_gchandle_free (target_handle);
        mono_error_set_pending_exception (&error);
        return NULL;
 }