From a5be5509645fcdd88eb08005ac900c82ff2d34d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 21 Aug 2021 15:26:53 +0200 Subject: [PATCH] module/alsa: free channel list on each connect attempt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise we’ll keep adding the same channel(s) over and over again, for each (successful) connect attempt. I.e. if you plug and unplug an USB soundcard repeatedly, we’ll keep extending the channel list each time. --- modules/alsa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/alsa.c b/modules/alsa.c index 368b1ee..d3f14e5 100644 --- a/modules/alsa.c +++ b/modules/alsa.c @@ -188,6 +188,9 @@ run_while_online(struct module *mod) struct private *m = mod->private; enum run_state ret = RUN_ERROR; + /* Make sure we aren’t still tracking channels from previous connects */ + tll_free(m->channels); + snd_mixer_t *handle; if (snd_mixer_open(&handle, 0) != 0) { LOG_ERR("failed to open handle");