From 5f508702229febe6c042de2d4fe6d23b855cd410 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 17 Jul 2006 01:28:38 +0000 Subject: alsa: fix memory leaks from snd_*_open*() ALSA uses a global config structure that's overwritten (and not free'd) every time one of those functions is called, so we have to manually call snd_config_update_free_global() to release it. Hint taken from MEMORY-LEAK in the ALSA source code git-svn-id: https://svn.musicpd.org/mpd/trunk@4381 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/audioOutputs/audioOutput_alsa.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/audioOutputs/audioOutput_alsa.c') diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c index 351647ace..5150dd502 100644 --- a/src/audioOutputs/audioOutput_alsa.c +++ b/src/audioOutputs/audioOutput_alsa.c @@ -106,6 +106,7 @@ static int alsa_testDefault(void) int ret = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); + snd_config_update_free_global(); if(ret) { WARNING("Error opening default alsa device: %s\n", @@ -152,6 +153,7 @@ static int alsa_openDevice(AudioOutput * audioOutput) err = snd_pcm_open(&ad->pcmHandle, ad->device, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); + snd_config_update_free_global(); if(err < 0) { ad->pcmHandle = NULL; goto error; -- cgit v1.2.3