From 9b92a13dbc92b293f80d5704c51b14b819210958 Mon Sep 17 00:00:00 2001 From: Ryan Lucia Date: Tue, 24 Mar 2020 19:40:25 -0400 Subject: [PATCH] [metadata] Fix leak in custom attribute lookup (#33937) --- src/mono/mono/metadata/custom-attrs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/metadata/custom-attrs.c b/src/mono/mono/metadata/custom-attrs.c index a5e18b2..d45a40a 100644 --- a/src/mono/mono/metadata/custom-attrs.c +++ b/src/mono/mono/metadata/custom-attrs.c @@ -1627,8 +1627,10 @@ mono_custom_attrs_from_index_checked (MonoImage *image, guint32 idx, gboolean ig ++i; } len = attr_array->len; - if (!len) + if (!len) { + g_array_free (attr_array, TRUE); return NULL; + } ainfo = (MonoCustomAttrInfo *)g_malloc0 (MONO_SIZEOF_CUSTOM_ATTR_INFO + sizeof (MonoCustomAttrEntry) * len); ainfo->num_attrs = len; ainfo->image = image; -- 2.7.4