All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Henningsson <david.henningsson@canonical.com>
To: tiwai@suse.de, alsa-devel@alsa-project.org
Cc: superquad.vortex2@gmail.com,
	David Henningsson <david.henningsson@canonical.com>
Subject: [PATCH] pcm: route: Correctly close slave pcm when no matching chmap is found
Date: Tue, 27 May 2014 09:51:21 +0200	[thread overview]
Message-ID: <1401177081-22204-1-git-send-email-david.henningsson@canonical.com> (raw)

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>
---
 src/pcm/pcm_route.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c
index 49567ea..751e36f 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);
-- 
1.9.1

             reply	other threads:[~2014-05-27  7:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27  7:51 David Henningsson [this message]
2014-05-27  9:39 ` [PATCH] pcm: route: Correctly close slave pcm when no matching chmap is found Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401177081-22204-1-git-send-email-david.henningsson@canonical.com \
    --to=david.henningsson@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=superquad.vortex2@gmail.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.