From: Arran Cudbard-Bell Date: Wed, 23 Oct 2024 06:27:06 +0000 (-0600) Subject: Fix clang scan errors X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1140f659b7bc31c19d42460b7d59f339dcc79bb;p=thirdparty%2Ffreeradius-server.git Fix clang scan errors --- diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index 6c59c5d42ff..596893eba5d 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -1081,7 +1081,7 @@ static int dict_read_process_define(dict_tokenize_ctx_t *ctx, char **argv, int a if (argc >= 3) if (dict_process_flag_field(ctx, argv[2], &da) < 0) goto error; #ifdef STATIC_ANALYZER - if (!ctx->dict) goto fail; + if (!ctx->dict) goto error; #endif if (unlikely(dict_attr_parent_init(&da, parent) < 0)) goto error; @@ -1196,7 +1196,7 @@ static int dict_read_process_enum(dict_tokenize_ctx_t *ctx, char **argv, int arg */ #ifdef STATIC_ANALYZER - if (!ctx->dict) goto fail; + if (!ctx->dict) goto error; #endif if (unlikely(dict_attr_parent_init(&da, parent) < 0)) goto error; diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index 5ffbd4f347a..c90983472bf 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -1617,18 +1617,22 @@ int fr_dict_attr_add_initialised(fr_dict_attr_t *da) if (dict_attr_add_to_namespace(da->parent, da) < 0) return -1; #ifndef NDEBUG - /* - * Check if we added the attribute - */ - da = dict_attr_child_by_num(da->parent, da->attr); - if (!da) { - fr_strerror_printf("FATAL - Failed to find attribute number %u we just added to parent '%s'", da->attr, da->parent->name); - return -1; - } + { + fr_dict_attr_t const *found; - if (!dict_attr_by_name(NULL, da->parent, da->name)) { - fr_strerror_printf("FATAL - Failed to find attribute '%s' we just added to parent '%s'", da->name, da->parent->name); - return -1; + /* + * Check if we added the attribute + */ + found = dict_attr_child_by_num(da->parent, da->attr); + if (!found) { + fr_strerror_printf("FATAL - Failed to find attribute number %u we just added to parent '%s'", da->attr, da->parent->name); + return -1; + } + + if (!dict_attr_by_name(NULL, da->parent, da->name)) { + fr_strerror_printf("FATAL - Failed to find attribute '%s' we just added to parent '%s'", da->name, da->parent->name); + return -1; + } } #endif