From 1f6a90d5b35d05ba6466acc6c3dd71b9ca7c693c Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 14 Nov 2018 13:35:37 +0200 Subject: [PATCH] avctp: Fix possible crash when accepting browsing channel In order to stop the bt_io_accept from calling the callback with invalid session, if that is disconnected in the meantime, create the channel so it can properly be destroyed thus stopping the callback from being called. --- profiles/audio/avctp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c index 5f8625cf2..0b4c80ea7 100644 --- a/profiles/audio/avctp.c +++ b/profiles/audio/avctp.c @@ -1534,6 +1534,8 @@ static void avctp_browsing_confirm(struct avctp *session, GIOChannel *chan, if (bt_io_accept(chan, avctp_connect_browsing_cb, session, NULL, &err)) { avctp_set_state(session, AVCTP_STATE_BROWSING_CONNECTING, 0); + session->browsing = avctp_channel_create(session, chan, 1, + avctp_destroy_browsing); return; } -- 2.47.3