uc_mgr_open_ctl() calls uc_mgr_ctl_add() with an existing entry when
another device name resolves to the same control card. Adding that
entry to ctl_list again corrupts the list and can double-free the
control handle during failed UCM import cleanup.
Only link entries allocated by this invocation. Existing entries keep
their original list membership while their device aliases are added.
Closes: https://github.com/alsa-project/alsa-lib/pull/539
Signed-off-by: Reuben Grinberg <reuben.grinberg@aya.yale.edu>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
goto __nomem;
}
- list_add_tail(&(*ctl_list)->list, &uc_mgr->ctl_list);
+ if (cl)
+ list_add_tail(&(*ctl_list)->list, &uc_mgr->ctl_list);
return 0;
__nomem: