diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-10-25 16:59:07 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-10-26 10:40:54 +0300 |
commit | 0ede5ec788e225fd2e118a42b691f5aedc721bc0 (patch) | |
tree | f87c4590086f5c1ef7bc06363bb1e8cb780540fe | |
parent | 8acf3cad3795a4345ad3c6f7122911e674cdb255 (diff) |
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.
-rw-r--r-- | audio/avrcp.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/audio/avrcp.c b/audio/avrcp.c index e13b2316..884877e8 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) { |