From 7d525e4dec3024bb48760334c39189edbbd3ca79 Mon Sep 17 00:00:00 2001 From: whatdoineed2do/Ray Date: Sun, 24 Apr 2022 14:39:46 +0100 Subject: [PATCH] [rcp] bug fix on deinit() - the rcp_session_cleanup() adv the head of list so no need to do again in deinit loop --- src/outputs/rcp.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/outputs/rcp.c b/src/outputs/rcp.c index c8224478..a9dc4697 100644 --- a/src/outputs/rcp.c +++ b/src/outputs/rcp.c @@ -1100,11 +1100,15 @@ rcp_session_free(struct rcp_session *s) free(s); } + static void rcp_session_cleanup(struct rcp_session *rs) { struct rcp_session *s; + if (!rs) + return; + if (rs == rcp_sessions) rcp_sessions = rcp_sessions->next; else @@ -1113,9 +1117,12 @@ rcp_session_cleanup(struct rcp_session *rs) ; /* EMPTY */ if (!s) - DPRINTF(E_WARN, L_RCP, "WARNING: struct rcp_session not found in list; BUG!\n"); - else - s->next = rs->next; + { + DPRINTF(E_WARN, L_RCP, "WARNING: struct rcp_session (%s at %s) not found in list; BUG!\n", rs->devname, rs->address); + return; + } + + s->next = rs->next; } outputs_device_session_remove(rs->device->id); @@ -1354,10 +1361,7 @@ rcp_deinit(void) struct rcp_session *s; for (s = rcp_sessions; rcp_sessions; s = rcp_sessions) - { - rcp_sessions = s->next; - rcp_session_cleanup(s); - } + rcp_session_cleanup(s); } struct output_definition output_rcp =