Skip to content

Commit f755f3b

Browse files
authored
[metadata] Fix leaks when handling a few attributes (#16850)
[2019-08] [metadata] Fix leaks when handling a few attributes Callers of mono_reflection_create_custom_attr_data_args_noalloc were leaking some of the returned information. Accessed attributes are FixedBufferAttribute and UnmanagedFunctionPointerAttribute. Backport of #16675. /cc @BrzVlad
1 parent 5f9a2db commit f755f3b

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-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
@@ -3902,7 +3902,9 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
39023902
} else {
39033903
g_assert_not_reached ();
39043904
}
3905+
g_free (named_args [i]);
39053906
}
3907+
g_free (typed_args [0]);
39063908
g_free (typed_args);
39073909
g_free (named_args);
39083910
g_free (arginfo);

mono/mini/debugger-agent.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3229,6 +3229,7 @@ static gint32 isFixedSizeArray (MonoClassField *f)
32293229
if (!is_ok (error))
32303230
return FALSE;
32313231
ret = *(gint32*)typed_args [1];
3232+
g_free (typed_args [1]);
32323233
g_free (typed_args);
32333234
g_free (named_args);
32343235
g_free (arginfo);

0 commit comments

Comments
 (0)