Skip to content

Commit a6b5187

Browse files
authored
[metadata] Fix leaks when handling a few attributes (#16675) (#16851)
Callers of mono_reflection_create_custom_attr_data_args_noalloc were leaking some of the returned information. Accessed attributes are FixedBufferAttribute and UnmanagedFunctionPointerAttribute.
1 parent 7da9a04 commit a6b5187

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

mono/metadata/marshal-ilgen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ get_fixed_buffer_attr (MonoClassField *field, MonoType **out_etype, int *out_len
182182
return FALSE;
183183
*out_etype = (MonoType*)typed_args [0];
184184
*out_len = *(gint32*)typed_args [1];
185+
g_free (typed_args [1]);
185186
g_free (typed_args);
186187
g_free (named_args);
187188
g_free (arginfo);

mono/metadata/marshal.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3907,7 +3907,9 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
39073907
} else {
39083908
g_assert_not_reached ();
39093909
}
3910+
g_free (named_args [i]);
39103911
}
3912+
g_free (typed_args [0]);
39113913
g_free (typed_args);
39123914
g_free (named_args);
39133915
g_free (arginfo);

0 commit comments

Comments
 (0)