diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 7f14c88..0a66589 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
struct a2dp_setup *setup = user_data;
uint16_t omtu, imtu;
+ if (!g_slist_find(setups, setup)) {
+ warn("bt_io_accept: setup %p no longer valid", setup);
+ g_io_channel_shutdown(io, TRUE, NULL);
+ return;
+ }
+
if (err) {
error("%s", err->message);
goto drop;
}
BLUETOOTH_PLUGIN_DEFINE(a2dp, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
- a2dp_init, a2dp_exit)
+ a2dp_init, a2dp_exit)