Skip to content

Commit 1158ea0

Browse files
committed
[mono][interp] Free mheader in case of inline failure
The header local types are not used anywhere so we can just free it.
1 parent 10e7596 commit 1158ea0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/mono/mono/mini/interp/transform.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3103,6 +3103,7 @@ interp_inline_newobj (TransformData *td, MonoMethod *target_method, MonoMethodSi
31033103
int dreg, this_reg = -1;
31043104
int prev_sp_offset;
31053105
MonoClass *klass = target_method->klass;
3106+
MonoMethodHeader *mheader = NULL;
31063107

31073108
if (!(mono_interp_opt & INTERP_OPT_INLINE) ||
31083109
!interp_method_check_inlining (td, target_method, csignature))
@@ -3166,7 +3167,7 @@ interp_inline_newobj (TransformData *td, MonoMethod *target_method, MonoMethodSi
31663167
if (is_protected)
31673168
newobj_fast->flags |= INTERP_INST_FLAG_PROTECTED_NEWOBJ;
31683169

3169-
MonoMethodHeader *mheader = interp_method_get_header (target_method, error);
3170+
mheader = interp_method_get_header (target_method, error);
31703171
goto_if_nok (error, fail);
31713172

31723173
if (!interp_inline_method (td, target_method, mheader, error))
@@ -3180,6 +3181,7 @@ interp_inline_newobj (TransformData *td, MonoMethod *target_method, MonoMethodSi
31803181
push_var (td, dreg);
31813182
return TRUE;
31823183
fail:
3184+
mono_metadata_free_mh (mheader);
31833185
// Restore the state
31843186
td->sp = td->stack + prev_sp_offset;
31853187
td->last_ins = prev_last_ins;
@@ -3651,6 +3653,7 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target
36513653
td->ip += 5;
36523654
goto done;
36533655
}
3656+
mono_metadata_free_mh (mheader);
36543657
}
36553658

36563659
/*

0 commit comments

Comments
 (0)