From eb059a789c1018367c80a5344ccfd834c27fa3d3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 21 Apr 2009 22:47:08 +0200 Subject: alsa_mixer: call snd_config_update_free_global() in finish() snd_config_update_free_global() frees cached ALSA configuration. This keeps valgrind a little bit more quiet. This patch moves the call from the open() method into the finish() method, which seems more natural: it allows the use of the config cache, and improves the cleanup phase. --- src/mixer/alsa_mixer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mixer/alsa_mixer.c b/src/mixer/alsa_mixer.c index 7b161cd14..fb0834338 100644 --- a/src/mixer/alsa_mixer.c +++ b/src/mixer/alsa_mixer.c @@ -61,6 +61,9 @@ alsa_mixer_finish(struct mixer *data) struct alsa_mixer *am = (struct alsa_mixer *)data; g_free(am); + + /* free libasound's config cache */ + snd_config_update_free_global(); } static void @@ -83,7 +86,6 @@ alsa_mixer_open(struct mixer *data) am->volume_set = -1; err = snd_mixer_open(&am->handle, 0); - snd_config_update_free_global(); if (err < 0) { g_warning("problems opening alsa mixer: %s\n", snd_strerror(err)); return false; -- cgit v1.2.3