diff --git a/src/connection.c b/src/connection.c index b96bb651..f5c4f04b 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1341,6 +1341,7 @@ static void _handle_authed_client(client_t *client, void *userdata, auth_result static void _handle_authentication_global(client_t *client, void *userdata, auth_result result) { ice_config_t *config; + auth_stack_t *authstack; auth_stack_release(client->authstack); client->authstack = NULL; @@ -1353,8 +1354,11 @@ static void _handle_authentication_global(client_t *client, void *userdata, auth ICECAST_LOG_DEBUG("Trying global authenticators for client %p.", client); config = config_get_config(); - auth_stack_add_client(config->authstack, client, _handle_authed_client, userdata); + authstack = config->authstack; + auth_stack_addref(authstack); config_release_config(); + auth_stack_add_client(authstack, client, _handle_authed_client, userdata); + auth_stack_release(authstack); } static inline mount_proxy * __find_non_admin_mount(ice_config_t *config, const char *name, mount_type type) diff --git a/src/stats.c b/src/stats.c index cebb865c..9a9c7295 100644 --- a/src/stats.c +++ b/src/stats.c @@ -843,6 +843,10 @@ static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, i xmlNodePtr ret = NULL; ice_config_t *config; + config = config_get_config(); + __add_authstack(config->authstack, root); + config_release_config(); + thread_mutex_lock(&_stats_mutex); /* general stats first */ avlnode = avl_get_first(_stats.global_tree); @@ -855,9 +859,6 @@ static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, i } /* now per mount stats */ avlnode = avl_get_first(_stats.source_tree); - config = config_get_config(); - __add_authstack(config->authstack, root); - config_release_config(); while (avlnode) { stats_source_t *source = (stats_source_t *)avlnode->key;