Merge pull request #1457 from whatdoineed2do/rcp-cleanup-bug

[rcp] bug fix on deinit()
This commit is contained in:
ejurgensen 2022-04-24 17:39:45 +02:00 committed by GitHub
commit 8531a27235
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1100,11 +1100,15 @@ rcp_session_free(struct rcp_session *s)
free(s); free(s);
} }
static void static void
rcp_session_cleanup(struct rcp_session *rs) rcp_session_cleanup(struct rcp_session *rs)
{ {
struct rcp_session *s; struct rcp_session *s;
if (!rs)
return;
if (rs == rcp_sessions) if (rs == rcp_sessions)
rcp_sessions = rcp_sessions->next; rcp_sessions = rcp_sessions->next;
else else
@ -1113,8 +1117,11 @@ rcp_session_cleanup(struct rcp_session *rs)
; /* EMPTY */ ; /* EMPTY */
if (!s) if (!s)
DPRINTF(E_WARN, L_RCP, "WARNING: struct rcp_session not found in list; BUG!\n"); {
else 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; s->next = rs->next;
} }
@ -1354,11 +1361,8 @@ rcp_deinit(void)
struct rcp_session *s; struct rcp_session *s;
for (s = rcp_sessions; rcp_sessions; s = rcp_sessions) 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 = struct output_definition output_rcp =
{ {