]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
try to quiet static analyzers
authorAlan T. DeKok <aland@freeradius.org>
Sat, 9 Sep 2023 20:58:16 +0000 (16:58 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 9 Sep 2023 20:58:16 +0000 (16:58 -0400)
src/lib/util/dict.h
src/lib/util/dict_unknown.c
src/lib/util/pair_legacy.c

index f4dc781891c026533afe6c61c680292b5b0dfdd6..30c52345e428dab9a76d10d8bbcde5ca73bd0881 100644 (file)
@@ -392,10 +392,10 @@ fr_dict_attr_t            *fr_dict_unknown_attr_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t c
 
 
 fr_slen_t              fr_dict_unknown_afrom_oid_substr(TALLOC_CTX *ctx,
-                                                        fr_dict_attr_t **out,
+                                                        fr_dict_attr_t const **out,
                                                         fr_dict_attr_t const *parent,
                                                         fr_sbuff_t *in)
-                                                        CC_HINT(nonnull);
+                                                        CC_HINT(nonnull(2,3,4));
 
 int                    fr_dict_attr_unknown_parent_to_known(fr_dict_attr_t *da, fr_dict_attr_t const *parent);
 
index d91e6531ec574120c31cba7d5e3365551053e1aa..fcf82f76ebe86731dc5813ab4e0370cc503f36d6 100644 (file)
@@ -391,7 +391,7 @@ fr_dict_attr_t      *fr_dict_unknown_attr_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t co
  *     - <= 0 on failure.  Negative offset indicates parse error position.
  */
 fr_slen_t fr_dict_unknown_afrom_oid_substr(TALLOC_CTX *ctx,
-                                          fr_dict_attr_t **out,
+                                          fr_dict_attr_t const **out,
                                           fr_dict_attr_t const *parent,
                                           fr_sbuff_t *in)
 {
index 95b291c64072b859df284056b86dbd9f942654ad..5dc179ed33c6a9b6bb4b9758e8762f57f891e25e 100644 (file)
@@ -115,7 +115,7 @@ static ssize_t fr_pair_list_afrom_substr(TALLOC_CTX *ctx, fr_dict_attr_t const *
                ssize_t slen;
                fr_token_t op;
                fr_dict_attr_t const *da, *my_parent;
-               fr_dict_attr_t *da_unknown = NULL;
+               fr_dict_attr_t const *da_unknown = NULL;
                fr_dict_attr_err_t err;
 
                fr_skip_whitespace(p);
@@ -225,6 +225,7 @@ static ssize_t fr_pair_list_afrom_substr(TALLOC_CTX *ctx, fr_dict_attr_t const *
                                fr_strerror_printf("Unknown attribute \"%.*s\" for parent \"%s\"", (int) (q - ((uint8_t const *) p)), p, my_parent->name);
                        }
                error:
+                       fr_dict_unknown_free(&da_unknown);
                        *token = T_INVALID;
                        return -(p - buffer);
                }
@@ -239,6 +240,10 @@ static ssize_t fr_pair_list_afrom_substr(TALLOC_CTX *ctx, fr_dict_attr_t const *
                }
 
        do_next:
+#ifdef STATIC_ANALYZER
+               if (!da) goto error;
+#endif
+
                next = p + slen;
 
                rhs[0] = '\0';
@@ -252,7 +257,6 @@ static ssize_t fr_pair_list_afrom_substr(TALLOC_CTX *ctx, fr_dict_attr_t const *
                 */
                op = gettoken(&p, rhs, sizeof(rhs), false);
                if ((op  < T_EQSTART) || (op  > T_EQEND)) {
-                       fr_dict_unknown_free(&da);
                        fr_strerror_const("Expecting operator");
                        goto error;
                }
@@ -285,6 +289,7 @@ static ssize_t fr_pair_list_afrom_substr(TALLOC_CTX *ctx, fr_dict_attr_t const *
                        if (fr_pair_append_by_da_parent(my_ctx, &vp, my_list, da) < 0) goto error;
                }
 
+//             fr_dict_unknown_free(&da_unknown);
                vp->op = op;
 
                /*