Diff between 158248f20a8d5c106737e4a4e5ad1bf33563c7c2 and 1721258a7d95b8f294d8875ff030eca9b24a2e60

Changed Files

File Additions Deletions Status
profiles/audio/sink.c +3 -3 modified
profiles/audio/source.c +3 -3 modified

Full Patch

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
@@ -396,13 +396,13 @@ int sink_disconnect(struct btd_service *service)
 
 	/* 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
@@ -388,13 +388,13 @@ int source_disconnect(struct btd_service *service)
 
 	/* 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;
 	}