]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't pass a "free" function
authorAlan T. DeKok <aland@freeradius.org>
Fri, 13 Apr 2018 19:55:13 +0000 (15:55 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 16 Apr 2018 18:41:31 +0000 (14:41 -0400)
the stats info is parented from the rbtree, so using a free
function results in a double free.

src/modules/rlm_stats/rlm_stats.c

index 3d17bc495b6477f846f7b5f5e2b8cc23cd4509f4..855457a87b5ea33231cb2c0c6216e15aafa5272d 100644 (file)
@@ -349,14 +349,6 @@ static int data_cmp(const void *one, const void *two)
        return fr_ipaddr_cmp(&a->ipaddr, &b->ipaddr);
 }
 
-static void data_free(void *one)
-{
-       rlm_stats_data_t *a = one;
-
-       talloc_free(a);
-}
-
-
 /** Instantiate thread data for the submodule.
  *
  */
@@ -373,8 +365,8 @@ static int mod_thread_instantiate(UNUSED CONF_SECTION const *cs, void *instance,
        pthread_mutex_init(&t->src_mutex, NULL);
        pthread_mutex_init(&t->dst_mutex, NULL);
 #endif
-       t->src = rbtree_talloc_create(t, data_cmp, rlm_stats_data_t, data_free, RBTREE_FLAG_NONE);
-       t->dst = rbtree_talloc_create(t, data_cmp, rlm_stats_data_t, data_free, RBTREE_FLAG_NONE);
+       t->src = rbtree_talloc_create(t, data_cmp, rlm_stats_data_t, NULL, RBTREE_FLAG_NONE);
+       t->dst = rbtree_talloc_create(t, data_cmp, rlm_stats_data_t, NULL, RBTREE_FLAG_NONE);
 
        PTHREAD_MUTEX_LOCK(&inst->mutex);
        fr_dlist_insert_head(&inst->entry, &t->entry);