Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2022-02-24 12:01:58 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2022-02-24 12:01:58 +0300
commit5977f1ca54572edc708eb2052bc5e1b7fb5802e7 (patch)
tree4280fb40e4efa8365374e04d8c61f200fa9a116b
parentf9d44382fbb9331865283d8500f181ae18d99e3b (diff)
Fix leak in mono_marshal_get_managed_wrapper
Introduced by f9d44382fbb9331865283d8500f181ae18d99e3b
-rw-r--r--mono/metadata/marshal.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c
index c538bab36f6..5a8916a4266 100644
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -3793,12 +3793,9 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
mono_error_set_invalid_program (error, "method %s with UnmanagedCallersOnlyAttribute has non-blittable parameters or return type", mono_method_full_name (method, TRUE));
return NULL;
}
- mspecs = g_new0 (MonoMarshalSpec*, invoke_sig->param_count + 1);
} else {
invoke = mono_get_delegate_invoke_internal (delegate_klass);
invoke_sig = mono_method_signature_internal (invoke);
- mspecs = g_new0 (MonoMarshalSpec*, invoke_sig->param_count + 1);
- mono_method_get_marshal_info (invoke, mspecs);
}
if (invoke_sig->ret->type == MONO_TYPE_GENERICINST) {
@@ -3806,6 +3803,11 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
return NULL;
}
+ mspecs = g_new0 (MonoMarshalSpec*, invoke_sig->param_count + 1);
+ if (invoke) {
+ mono_method_get_marshal_info (invoke, mspecs);
+ }
+
sig = mono_method_signature_internal (method);
mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_NATIVE_TO_MANAGED);