From acb3f4a5c8cf88a092ef08752efcbeb3e55d401a Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Sat, 18 Sep 2021 09:19:06 -0400 Subject: [PATCH] use local boolean. by the time we get to checking if attr<0, it's already been updated and allocated. --- src/lib/util/dict_util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index aefa3aa607..e5c9e65c58 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -1138,12 +1138,15 @@ int fr_dict_attr_add(fr_dict_t *dict, fr_dict_attr_t const *parent, fr_dict_attr_t *n; fr_dict_attr_t const *old; fr_dict_attr_flags_t our_flags = *flags; + bool self_allocated = false; if (unlikely(dict->read_only)) { fr_strerror_printf("%s dictionary has been marked as read only", fr_dict_root(dict)->name); return -1; } + self_allocated = (attr < 0); + /* * Check that the definition is valid. */ @@ -1161,7 +1164,7 @@ int fr_dict_attr_add(fr_dict_t *dict, fr_dict_attr_t const *parent, */ if ((old->parent == parent) && (old->type == type) && FLAGS_EQUAL(array) && FLAGS_EQUAL(subtype) && - ((old->attr == (unsigned int) attr) || ((attr < 0) && old->flags.internal))) { + ((old->attr == (unsigned int) attr) || self_allocated)) { return 0; } -- 2.47.2