osx_write: Check return value of AudioOutputUnitStart().
authorAndre Noll <maan@systemlinux.org>
Thu, 9 Aug 2012 19:07:03 +0000 (21:07 +0200)
committerAndre Noll <maan@systemlinux.org>
Tue, 30 Oct 2012 12:24:32 +0000 (13:24 +0100)
This function may fail, and we even have an error code for this condition
available.

osx_write.c

index d278d02..2894f11 100644 (file)
@@ -318,7 +318,13 @@ static void osx_write_post_select(__a_unused struct sched *s, struct task *t)
                if (ret < 0)
                        goto remove_btrn;
                powd = wn->private_data;
-               AudioOutputUnitStart(powd->audio_unit);
+               ret = -E_UNIT_START;
+               if (AudioOutputUnitStart(powd->audio_unit) != noErr) {
+                       AudioUnitUninitialize(powd->audio_unit);
+                       CloseComponent(powd->audio_unit);
+                       btr_remove_node(&powd->callback_btrn);
+                       goto remove_btrn;
+               }
        }
        mutex_lock(powd->mutex);
        ret = btr_node_status(btrn, wn->min_iqs, BTR_NT_INTERNAL);