Mercurial > audlegacy-plugins
changeset 3173:3fd0d762371c
alsa-ng: alsaplug_buffer_free(): Make sure we don't try to access the ringbuffer when it's not yet allocated.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Fri, 15 May 2009 16:10:31 -0500 |
parents | 1b2350bdeaef |
children | 8106e1b31115 |
files | src/alsa-ng/alsa-core.c |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alsa-ng/alsa-core.c Fri May 15 16:06:55 2009 -0500 +++ b/src/alsa-ng/alsa-core.c Fri May 15 16:10:31 2009 -0500 @@ -250,7 +250,18 @@ static gint alsaplug_buffer_free(void) { - return alsaplug_ringbuffer_free(&pcm_ringbuf); + gint ret; + + g_mutex_lock(pcm_state_mutex); + + if (pcm_going == FALSE) + ret = 0; + else + ret = alsaplug_ringbuffer_free(&pcm_ringbuf); + + g_mutex_unlock(pcm_state_mutex); + + return ret; } static void