[pulseaudio-discuss] [PATCH v0 11/16] bluetooth: Check return value of start_thread()

Mikel Astiz mikel.astiz.oss at gmail.com
Fri Sep 28 08:45:35 PDT 2012


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

The function can return an error, so in that case the profile change
should fail.
---
 src/modules/bluetooth/module-bluetooth-device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index b6bdd52..68838e7 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2146,7 +2146,6 @@ static int start_thread(struct userdata *u) {
 
     if (!(u->thread = pa_thread_new("bluetooth", thread_func, u))) {
         pa_log_error("Failed to create IO thread");
-        stop_thread(u);
         return -1;
     }
 
@@ -2269,7 +2268,8 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
             goto off;
 
     if (u->sink || u->source)
-        start_thread(u);
+        if (start_thread(u) < 0)
+            goto off;
 
     move_all_end(u, inputs, outputs);
 
-- 
1.7.11.4



More information about the pulseaudio-discuss mailing list