From 9eaa22ecdafa718fc2a84a70d442c829ae7e1b34 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 9 Aug 2012 21:07:03 +0200 Subject: [PATCH] osx_write: Check return value of AudioOutputUnitStart(). This function may fail, and we even have an error code for this condition available. --- osx_write.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osx_write.c b/osx_write.c index d278d02c..2894f11e 100644 --- a/osx_write.c +++ b/osx_write.c @@ -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); -- 2.39.5