bluetooth: correct possible segmentation fault
authormorrishoresh <morris_horesh@yahoo.com>
Thu, 24 Dec 2020 21:58:54 +0000 (23:58 +0200)
committerArun Raghavan <arun@asymptotic.io>
Fri, 25 Dec 2020 15:36:02 +0000 (10:36 -0500)
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/443>

src/modules/bluetooth/backend-ofono.c

index 0e5bbe8..d7a13ef 100644 (file)
@@ -627,8 +627,6 @@ static DBusMessage *hf_audio_agent_new_connection(DBusConnection *c, DBusMessage
 
     card = pa_hashmap_get(backend->cards, path);
 
-    card->connecting = false;
-
     if (!card || codec != HFP_AUDIO_CODEC_CVSD || card->fd >= 0) {
         pa_log_warn("New audio connection invalid arguments (path=%s fd=%d, codec=%d)", path, fd, codec);
         pa_assert_se(r = dbus_message_new_error(m, "org.ofono.Error.InvalidArguments", "Invalid arguments in method call"));
@@ -639,6 +637,7 @@ static DBusMessage *hf_audio_agent_new_connection(DBusConnection *c, DBusMessage
 
     pa_log_debug("New audio connection on card %s (fd=%d, codec=%d)", path, fd, codec);
 
+    card->connecting = false;
     card->fd = fd;
     card->transport->codec = codec;