From 0ede5ec788e225fd2e118a42b691f5aedc721bc0 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 25 Oct 2012 16:59:07 +0300 Subject: [PATCH] AVRCP: Fix not adding session to player's list of sessions If the session is not added in the list if the player gets unregistered it will not be cleared from the session which might cause a crash if the tries to access it. --- audio/avrcp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/audio/avrcp.c b/audio/avrcp.c index e13b2316f..884877e8a 100644 --- a/audio/avrcp.c +++ b/audio/avrcp.c @@ -1443,10 +1443,16 @@ static struct avrcp *find_session(GSList *list, struct audio_device *dev) static void session_tg_init(struct avrcp *session) { struct avrcp_server *server = session->server; + struct avrcp_player *player; DBG("%p version 0x%04x", session, session->version); - session->player = g_slist_nth_data(server->players, 0); + player = g_slist_nth_data(server->players, 0); + if (player != NULL) { + session->player = player; + player->sessions = g_slist_prepend(player->sessions, session); + } + session->control_handlers = tg_control_handlers; if (session->version >= 0x0104) { -- 2.47.3