[marshal] Rethrow in native-to-managed wrapper to keep exception stacktrace (#5384)
[mono.git] / mono / metadata / marshal.c
index 5eb477a909673e92570f65c3437810468448dc0d..63358bf3baff17983faf525d7d4c0fe1c9d5b5b1 100644 (file)
@@ -814,7 +814,7 @@ mono_array_to_lparray (MonoArray *array)
                break;
        case MONO_TYPE_CLASS:
                nativeArraySize = array->max_length;
-               nativeArray = (void **)malloc(sizeof(gpointer) * nativeArraySize);
+               nativeArray = (void **)g_malloc (sizeof(gpointer) * nativeArraySize);
                for(i = 0; i < nativeArraySize; ++i) {
                        nativeArray[i] = mono_cominterop_get_com_interface (((MonoObject **)array->vector)[i], klass->element_class, &error);
                        if (mono_error_set_pending_exception (&error))
@@ -12366,7 +12366,7 @@ ftnptr_eh_callback_default (guint32 gchandle)
 
        mono_gchandle_free (gchandle);
 
-       mono_raise_exception (exc);
+       mono_reraise_exception (exc);
 }
 
 /*