mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-10 13:30:01 -05:00
PCM: Fix memory leak for pcm empty and asym plugins
The init-only plugins do not have own pcm handle, so free the references to open function immediately after open. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
2b49df0c55
commit
edcd677bf2
1 changed files with 6 additions and 1 deletions
|
|
@ -2171,7 +2171,12 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
|
|||
if (open_func) {
|
||||
err = open_func(pcmp, name, pcm_root, pcm_conf, stream, mode);
|
||||
if (err >= 0) {
|
||||
(*pcmp)->open_func = open_func;
|
||||
if ((*pcmp)->open_func) {
|
||||
/* only init plugin (like empty, asym) */
|
||||
snd_dlobj_cache_put(open_func);
|
||||
} else {
|
||||
(*pcmp)->open_func = open_func;
|
||||
}
|
||||
err = 0;
|
||||
} else {
|
||||
snd_dlobj_cache_put(open_func);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue