From: Andre Noll Date: Fri, 1 May 2009 12:05:47 +0000 (+0200) Subject: alsa: Do not call alsa shutdown functions if alsa wasn't yet initialized. X-Git-Tag: v0.3.4~7 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=3e1a2e10f0f145033d8aa7db512b2c29808014a7;p=paraslash.git 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. --- 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); }