bluetooth: Check return value of start_thread()
authorMikel Astiz <mikel.astiz@bmw-carit.de>
Fri, 19 Oct 2012 08:11:23 +0000 (10:11 +0200)
committerTanu Kaskinen <tanuk@iki.fi>
Fri, 19 Oct 2012 15:22:51 +0000 (18:22 +0300)
The function can return an error, so in that case the profile change
should fail.

src/modules/bluetooth/module-bluetooth-device.c

index 33d42fe1ce11b2d31756afa1f1e975499b3b0fd8..4b98108ae96d5813f73fd220bd2f4b70632ddc42 100644 (file)
@@ -2142,7 +2142,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;
     }
 
@@ -2233,7 +2232,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;
 
     return 0;