summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2014-05-27 09:51:21 +0200
committerTakashi Iwai <tiwai@suse.de>2014-05-27 11:21:52 +0200
commit84f8b976c052254a3e80bcf0eb0f198a480b2988 (patch)
treef1f65169f1ba2826f83f50c5a0bb6455d33443da
parent80a43f23dbca7a440cc95f73feecf20516eb99de (diff)
downloadalsa-lib-84f8b976c052254a3e80bcf0eb0f198a480b2988.tar.gz
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 <superquad.vortex2@gmail.com> Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--src/pcm/pcm_route.c4
1 files changed, 3 insertions, 1 deletions
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);