module/alsa: free channel list on each connect attempt

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.
This commit is contained in:
Daniel Eklöf 2021-08-21 15:26:53 +02:00
parent 360e1fbada
commit a5be550964
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -188,6 +188,9 @@ run_while_online(struct module *mod)
struct private *m = mod->private;
enum run_state ret = RUN_ERROR;
/* Make sure we arent 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");