osx_write: Check return value of AudioOutputUnitStart().
[paraslash.git] / osx_write.c
index d278d02c8ed5be97ffb0eb56b15825343c02e21c..2894f11eb6672dd5f06fa1f3166f6a77afad7ae0 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);