]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix clang scan errors
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 23 Oct 2024 06:27:06 +0000 (00:27 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 24 Oct 2024 23:07:56 +0000 (17:07 -0600)
src/lib/util/dict_tokenize.c
src/lib/util/dict_util.c

index 6c59c5d42ff437629a5894dd79ff67fec123ef24..596893eba5d311e1edc32450951741c1ce85d663 100644 (file)
@@ -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;
index 5ffbd4f347a42fc35855a1a95238faeea8a3ceda..c90983472bf3bcab8d6ecd1154814920b26853b2 100644 (file)
@@ -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