From: Alan T. DeKok Date: Fri, 22 Jan 2021 16:14:19 +0000 (-0500) Subject: allocate child_struct for all key fields X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e8d07ab1732df41698f54d8a51fafc75501173a0;p=thirdparty%2Ffreeradius-server.git allocate child_struct for all key fields even if it doesn't actually use child structs --- diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index 4ff447d1c5a..826fdef10c2 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -1302,7 +1302,7 @@ int dict_attr_enum_add_name(fr_dict_attr_t *da, char const *name, * Allocate a structure to map between * the name and value. */ - enumv = talloc_zero_size(da, sizeof(fr_dict_enum_t) + sizeof(enumv->child_struct[0]) * (child_struct != NULL)); + enumv = talloc_zero_size(da, sizeof(fr_dict_enum_t) + sizeof(enumv->child_struct[0]) * fr_dict_attr_is_key_field(da)); if (!enumv) { oom: fr_strerror_printf("%s: Out of memory", __FUNCTION__);