]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use the talloc hierarchy
authorAlan T. DeKok <aland@freeradius.org>
Wed, 2 Dec 2020 15:08:40 +0000 (10:08 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 2 Dec 2020 15:08:40 +0000 (10:08 -0500)
src/lib/util/hash.c

index 0722c1e6665fa27937915e476be8a579c7cea2df..520917ab342d172bfcc7beccbea5a2ecc6ebe938 100644 (file)
@@ -308,7 +308,7 @@ fr_hash_table_t *fr_hash_table_create(TALLOC_CTX *ctx,
         */
        ht->next_grow = (ht->num_buckets << 1) + (ht->num_buckets >> 1);
 
-       ht->buckets = talloc_zero_array(NULL, fr_hash_entry_t *, ht->num_buckets);
+       ht->buckets = talloc_zero_array(ht, fr_hash_entry_t *, ht->num_buckets);
        if (!ht->buckets) {
                talloc_free(ht);
                return NULL;
@@ -387,7 +387,7 @@ static void fr_hash_table_grow(fr_hash_table_t *ht)
 {
        fr_hash_entry_t **buckets;
 
-       buckets = talloc_zero_array(NULL, fr_hash_entry_t *, GROW_FACTOR * ht->num_buckets);
+       buckets = talloc_array(ht, fr_hash_entry_t *, GROW_FACTOR * ht->num_buckets);
        if (!buckets) return;
 
        memcpy(buckets, ht->buckets, sizeof(*buckets) * ht->num_buckets);
@@ -426,7 +426,7 @@ int fr_hash_table_insert(fr_hash_table_t *ht, void const *data)
         *      If we try to do our own memory allocation here, the
         *      speedup is only ~15% or so, which isn't worth it.
         */
-       node = talloc_zero(NULL, fr_hash_entry_t);
+       node = talloc_zero(ht, fr_hash_entry_t);
        if (!node) return 0;
 
        node->next = &ht->null;