diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c
index 3167b3a..7cac210 100644
--- a/profiles/audio/sink.c
+++ b/profiles/audio/sink.c
/* cancel pending connect */
if (sink->connect_id > 0) {
+ avdtp_unref(sink->session);
+ sink->session = NULL;
+
a2dp_cancel(sink->connect_id);
sink->connect_id = 0;
btd_service_disconnecting_complete(sink->service, 0);
- avdtp_unref(sink->session);
- sink->session = NULL;
-
return 0;
}
diff --git a/profiles/audio/source.c b/profiles/audio/source.c
index 493524e..4081e19 100644
--- a/profiles/audio/source.c
+++ b/profiles/audio/source.c
/* cancel pending connect */
if (source->connect_id > 0) {
+ avdtp_unref(source->session);
+ source->session = NULL;
+
a2dp_cancel(source->connect_id);
source->connect_id = 0;
btd_service_disconnecting_complete(source->service, 0);
- avdtp_unref(source->session);
- source->session = NULL;
-
return 0;
}