From 3e1a2e10f0f145033d8aa7db512b2c29808014a7 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 1 May 2009 14:05:47 +0200 Subject: [PATCH] alsa: Do not call alsa shutdown functions if alsa wasn't yet initialized. This might happen if the wng is destroyed before any output was produced. This bug could trigger para_audiod: pcm.c:1105: snd_pcm_drain: Assertion `pcm' failed causing audiod to crash. --- alsa_write.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/alsa_write.c b/alsa_write.c index 4bf89297..e070399d 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -211,9 +211,12 @@ static void alsa_close(struct writer_node *wn) { struct private_alsa_write_data *pad = wn->private_data; PARA_INFO_LOG("closing writer node %p\n", wn); - snd_pcm_drain(pad->handle); - snd_pcm_close(pad->handle); - snd_config_update_free_global(); + + if (pad->handle) { + snd_pcm_drain(pad->handle); + snd_pcm_close(pad->handle); + snd_config_update_free_global(); + } free(pad); } -- 2.39.5