]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
clean up autofree
authorAlan T. DeKok <aland@freeradius.org>
Sun, 4 Feb 2024 15:15:35 +0000 (10:15 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 4 Feb 2024 15:15:35 +0000 (10:15 -0500)
The only remaining errors are:

test.unit.dns, which fails to clean up the DNS dictionaries.
All of the other protocols are fine, so there's some extra magic
here.

test.keywords: fr_dict_free() is asked to remove a dependency
which doesn't exist.  That _should_ be an assertion, but for now
it's a recoverable error which lets other people get work done.

src/lib/util/dict_util.c

index a1bbd41cf9dfa8ac44e6e7194fd6d52dcfa5be9a..622ba05c95d5edd8e1e83649ec328b341f56796c 100644 (file)
@@ -3327,9 +3327,10 @@ static int dict_autoref_free(fr_dict_t *dict)
                return -1;
        }
 
+       /*
+        *      Free the dictionary.  It will call proto->free() if there's nothing more to do.
+        */
        for (i = 0; i < talloc_array_length(refd_list); i++) {
-               if (refd_list[i]->proto->free) refd_list[i]->proto->free();
-
                if (fr_dict_free(&refd_list[i], dict->root->name) < 0) {
                        fr_strerror_printf("failed freeing autoloaded protocol %s", refd_list[i]->root->name);
                        return -1;
@@ -3397,8 +3398,6 @@ static int _dict_free(fr_dict_t *dict)
                return -1;
        }
 
-//     if (dict_autoref_free(dict) < 0) return -1;
-
        /*
         *      Free the hash tables with free functions first
         *      so that the things the hash tables reference
@@ -3925,7 +3924,7 @@ static int _dict_global_free(fr_dict_gctx_t *gctx)
             dict = fr_hash_table_iter_next(gctx->protocol_by_name, &iter)) {
                (void)talloc_get_type_abort(dict, fr_dict_t);
 
-//             if (dict_autoref_free(dict) < 0) return -1;
+               if (dict_autoref_free(dict) < 0) return -1;
        }
 
        for (dict = fr_hash_table_iter_init(gctx->protocol_by_name, &iter);