X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=alsa_write.c;h=9822da674eda8029fe052e3c99c177e58816b8a5;hp=3935c8c687be53e25791abbb93697a8d61186527;hb=f1fe6d2729f2b0e7b48557d9cc5ddb4412a6bf22;hpb=8d106ca317a2c42f35a86ba244f843688f6939e6 diff --git a/alsa_write.c b/alsa_write.c index 3935c8c6..9822da67 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -1,8 +1,4 @@ -/* - * Copyright (C) 2005 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* Copyright (C) 2005 Andre Noll , see file COPYING. */ /** \file alsa_write.c paraslash's alsa output plugin */ @@ -244,6 +240,8 @@ static void alsa_close(struct writer_node *wn) if (!pad) return; + if (!pad->handle) + goto free_pad; /* * It's OK to have a blocking operation here because we already made * sure that the PCM output buffer is (nearly) empty. @@ -252,6 +250,7 @@ static void alsa_close(struct writer_node *wn) snd_pcm_drain(pad->handle); snd_pcm_close(pad->handle); snd_config_update_free_global(); +free_pad: free(pad); } @@ -270,6 +269,8 @@ static int alsa_write_post_select(__a_unused struct sched *s, void *context) goto err; again: ret = btr_node_status(btrn, wn->min_iqs, BTR_NT_LEAF); + if (ret < 0) + goto err; if (ret == 0) return 0; btr_merge(btrn, wn->min_iqs); @@ -306,11 +307,8 @@ again: PARA_INFO_LOG("%u channel(s), %uHz\n", pad->channels, pad->sample_rate); ret = alsa_init(wn); - if (ret < 0) { - free(wn->private_data); - wn->private_data = NULL; + if (ret < 0) goto err; - } wn->min_iqs = pad->bytes_per_frame; goto again; }