]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allocate ext for ref
authorAlan T. DeKok <aland@freeradius.org>
Mon, 10 May 2021 16:13:31 +0000 (12:13 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 10 May 2021 16:13:31 +0000 (12:13 -0400)
src/lib/util/dict_tokenize.c

index 60b2f2cc3735b4d86184cbb72e255d0e868a8063..b95586b5de3628761bf3b49394216ffb83795902 100644 (file)
@@ -603,13 +603,30 @@ static int dict_read_process_alias(dict_tokenize_ctx_t *ctx, char **argv, int ar
        if (unlikely(!self)) return -1;
 
        self->dict = ctx->dict;
-       dict_attr_ref_set(self, da);
+
+       /*
+        *      Allocate room for the reference.
+        */
+       if (dict_attr_ext_alloc(&self, FR_DICT_ATTR_EXT_REF) < 0) {
+               fr_strerror_const("Internal allocating reference");
+               goto error;
+       }
+
+       /*
+        *      Then set the reference.
+        */
+       if (dict_attr_ref_set(self, da) < 0) {
+               fr_strerror_const("Internal error storing reference");
+               goto error;
+       }
+
+       fr_assert(fr_dict_attr_ref(self) == da);
 
        namespace = dict_attr_namespace(parent);
        if (!namespace) {
                fr_strerror_printf("Attribute '%s' does not contain a namespace", parent->name);
        error:
-               talloc_const_free(da);
+               talloc_free(self);
                return -1;
        }