From: David Henningsson Date: Tue, 27 May 2014 07:51:21 +0000 (+0200) Subject: pcm: route: Correctly close slave pcm when no matching chmap is found X-Git-Tag: v1.0.28~11 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=84f8b976c052254a3e80bcf0eb0f198a480b2988;p=alsa-lib.git pcm: route: Correctly close slave pcm when no matching chmap is found This patch fixes a bug where the slave pcm was not correctly closed on some error conditions, such as not finding a matching chmap. Reported-by: Raymond Yau Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c index 49567ea1..751e36f2 100644 --- a/src/pcm/pcm_route.c +++ b/src/pcm/pcm_route.c @@ -1429,8 +1429,10 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, if (tt_chmap) { err = find_matching_chmap(spcm, tt_chmap, &chmap, &schannels); free(tt_chmap); - if (err < 0) + if (err < 0) { + snd_pcm_close(spcm); return err; + } } err = _snd_pcm_route_determine_ttable(tt, &csize, &ssize, chmap);