From c551c8b31b299b8fa24cf74ea4b35c4c001eaba5 Mon Sep 17 00:00:00 2001 From: Kurt Van Dijck Date: Fri, 24 Feb 2012 07:02:47 +0100 Subject: [PATCH] raop_output: fix raop_session inbalance raop_session_free must be called from raop_output_finish, not from raop_output_remove. In raop_output_remove, do close the ntp_server & control port. Signed-off-by: Kurt Van Dijck --- src/output/raop_output_plugin.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/output/raop_output_plugin.c b/src/output/raop_output_plugin.c index 68d6897cb..6177b9b7d 100644 --- a/src/output/raop_output_plugin.c +++ b/src/output/raop_output_plugin.c @@ -770,6 +770,11 @@ raop_output_finish(struct audio_output *ao) g_mutex_free(rd->control_mutex); ao_base_finish(&rd->base); g_free(rd); + + if (raop_session->raop_list == NULL) { + raop_session_free(raop_session); + raop_session = NULL; + } } #define RAOP_VOLUME_MIN -30 @@ -870,8 +875,9 @@ raop_output_remove(struct raop_data *rd) g_mutex_unlock(raop_session->list_mutex); if (raop_session->raop_list == NULL) { - raop_session_free(raop_session); - raop_session = NULL; + ntp_server_close(&raop_session->ntp); + close(raop_session->ctrl.fd); + raop_session->ctrl.fd = -1; } }