From 25ee24d2be72ef3c90d37ae5752e755c87aa2e34 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Fri, 30 Jul 2010 21:52:04 +0200 Subject: [PATCH] Properly deinit DAAP sessions Call event_del() before freeing the session when clearing the AVL tree. Caused an infinite loop in event_base_free() in httpd_deinit(). --- src/httpd_daap.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/httpd_daap.c b/src/httpd_daap.c index 3bb23f2f..51dc8cd1 100644 --- a/src/httpd_daap.c +++ b/src/httpd_daap.c @@ -526,11 +526,20 @@ daap_session_compare(const void *aa, const void *bb) return 0; } +static void +daap_session_free(void *item) +{ + struct daap_session *s; + + s = (struct daap_session *)item; + + evtimer_del(&s->timeout); + free(s); +} + static void daap_session_kill(struct daap_session *s) { - evtimer_del(&s->timeout); - avl_delete(daap_sessions, s); } @@ -2801,7 +2810,7 @@ daap_init(void) } } - daap_sessions = avl_alloc_tree(daap_session_compare, free); + daap_sessions = avl_alloc_tree(daap_session_compare, daap_session_free); if (!daap_sessions) { DPRINTF(E_FATAL, L_DAAP, "DAAP init could not allocate DAAP sessions AVL tree\n");