@@ -3103,6 +3103,7 @@ interp_inline_newobj (TransformData *td, MonoMethod *target_method, MonoMethodSi
3103
3103
int dreg , this_reg = -1 ;
3104
3104
int prev_sp_offset ;
3105
3105
MonoClass * klass = target_method -> klass ;
3106
+ MonoMethodHeader * mheader = NULL ;
3106
3107
3107
3108
if (!(mono_interp_opt & INTERP_OPT_INLINE ) ||
3108
3109
!interp_method_check_inlining (td , target_method , csignature ))
@@ -3166,7 +3167,7 @@ interp_inline_newobj (TransformData *td, MonoMethod *target_method, MonoMethodSi
3166
3167
if (is_protected )
3167
3168
newobj_fast -> flags |= INTERP_INST_FLAG_PROTECTED_NEWOBJ ;
3168
3169
3169
- MonoMethodHeader * mheader = interp_method_get_header (target_method , error );
3170
+ mheader = interp_method_get_header (target_method , error );
3170
3171
goto_if_nok (error , fail );
3171
3172
3172
3173
if (!interp_inline_method (td , target_method , mheader , error ))
@@ -3180,6 +3181,7 @@ interp_inline_newobj (TransformData *td, MonoMethod *target_method, MonoMethodSi
3180
3181
push_var (td , dreg );
3181
3182
return TRUE;
3182
3183
fail :
3184
+ mono_metadata_free_mh (mheader );
3183
3185
// Restore the state
3184
3186
td -> sp = td -> stack + prev_sp_offset ;
3185
3187
td -> last_ins = prev_last_ins ;
@@ -3214,10 +3216,14 @@ interp_constrained_box (TransformData *td, MonoClass *constrained_class, MonoMet
3214
3216
static MonoMethod *
3215
3217
interp_get_method (MonoMethod * method , guint32 token , MonoImage * image , MonoGenericContext * generic_context , MonoError * error )
3216
3218
{
3217
- if (method -> wrapper_type == MONO_WRAPPER_NONE )
3219
+ if (method -> wrapper_type == MONO_WRAPPER_NONE ) {
3218
3220
return mono_get_method_checked (image , token , NULL , generic_context , error );
3219
- else
3220
- return (MonoMethod * )mono_method_get_wrapper_data (method , token );
3221
+ } else {
3222
+ MonoMethod * target_method = mono_method_get_wrapper_data (method , token );
3223
+ if (generic_context )
3224
+ target_method = mono_class_inflate_generic_method_checked (target_method , generic_context , error );
3225
+ return target_method ;
3226
+ }
3221
3227
}
3222
3228
3223
3229
/*
@@ -3440,13 +3446,6 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target
3440
3446
target_method = interp_get_method (method , token , image , generic_context , error );
3441
3447
return_val_if_nok (error , FALSE);
3442
3448
csignature = mono_method_signature_internal (target_method );
3443
-
3444
- if (generic_context ) {
3445
- csignature = mono_inflate_generic_signature (csignature , generic_context , error );
3446
- return_val_if_nok (error , FALSE);
3447
- target_method = mono_class_inflate_generic_method_checked (target_method , generic_context , error );
3448
- return_val_if_nok (error , FALSE);
3449
- }
3450
3449
}
3451
3450
} else {
3452
3451
csignature = mono_method_signature_internal (target_method );
@@ -3654,6 +3653,7 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target
3654
3653
td -> ip += 5 ;
3655
3654
goto done ;
3656
3655
}
3656
+ mono_metadata_free_mh (mheader );
3657
3657
}
3658
3658
3659
3659
/*
0 commit comments