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:
Jaroslav Kysela 2012-10-30 11:43:07 +01:00
parent 2b49df0c55
commit edcd677bf2

View file

@ -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);