]> git.tue.mpg.de Git - paraslash.git/commitdiff
alsa: Do not call alsa shutdown functions if alsa wasn't yet initialized.
authorAndre Noll <maan@systemlinux.org>
Fri, 1 May 2009 12:05:47 +0000 (14:05 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 1 May 2009 12:05:47 +0000 (14:05 +0200)
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

index 4bf89297f77badcdc737e56a2fcaa888cdaef56e..e070399d3f0dbf0145fa39e090b46d5f7c6cbb63 100644 (file)
@@ -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);
 }