From: Alan T. DeKok Date: Sat, 18 Sep 2021 13:19:06 +0000 (-0400) Subject: use local boolean. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acb3f4a5c8cf88a092ef08752efcbeb3e55d401a;p=thirdparty%2Ffreeradius-server.git use local boolean. by the time we get to checking if attr<0, it's already been updated and allocated. --- 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; }