From patchwork Tue May 27 07:51:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Henningsson X-Patchwork-Id: 4246331 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0B1AF9F333 for ; Tue, 27 May 2014 07:51:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C4D920254 for ; Tue, 27 May 2014 07:51:47 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 0C1B520125 for ; Tue, 27 May 2014 07:51:46 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DA0D4265578; Tue, 27 May 2014 09:51:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id CD687265556; Tue, 27 May 2014 09:51:32 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B2FAF265566; Tue, 27 May 2014 09:51:31 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by alsa0.perex.cz (Postfix) with ESMTP id B7BA1265556 for ; Tue, 27 May 2014 09:51:23 +0200 (CEST) Received: from hd9483857.selulk5.dyn.perspektivbredband.net ([217.72.56.87] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1WpCAM-0006UZ-Qt; Tue, 27 May 2014 07:51:22 +0000 From: David Henningsson To: tiwai@suse.de, alsa-devel@alsa-project.org Date: Tue, 27 May 2014 09:51:21 +0200 Message-Id: <1401177081-22204-1-git-send-email-david.henningsson@canonical.com> X-Mailer: git-send-email 1.9.1 Cc: superquad.vortex2@gmail.com, David Henningsson Subject: [alsa-devel] [PATCH] pcm: route: Correctly close slave pcm when no matching chmap is found X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);