From patchwork Fri Sep 28 21:27:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guedes, Andre" X-Patchwork-Id: 10620333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B857D913 for ; Fri, 28 Sep 2018 21:28:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A68F12BF4C for ; Fri, 28 Sep 2018 21:28:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 992752BF63; Fri, 28 Sep 2018 21:28:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 374192BF4C for ; Fri, 28 Sep 2018 21:28:20 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B81A62678D5; Fri, 28 Sep 2018 23:28:05 +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 A3F252678C5; Fri, 28 Sep 2018 23:27:59 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by alsa0.perex.cz (Postfix) with ESMTP id B9BFB2678CA for ; Fri, 28 Sep 2018 23:27:57 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Sep 2018 14:27:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,316,1534834800"; d="scan'208";a="87635619" Received: from aguedesl-mobl1.jf.intel.com ([10.251.19.131]) by orsmga003.jf.intel.com with ESMTP; 28 Sep 2018 14:27:51 -0700 From: Andre Guedes To: alsa-devel@alsa-project.org Date: Fri, 28 Sep 2018 14:27:24 -0700 Message-Id: <20180928212727.15151-2-andre.guedes@intel.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180928212727.15151-1-andre.guedes@intel.com> References: <20180928212727.15151-1-andre.guedes@intel.com> Subject: [alsa-devel] [PATCH - Multiple plugins 1/4] a52: Fix leaks when a52_set_hw_constraint() fails 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 If a52_set_hw_constraint() returns error, we leak 'rec' and 'rec->slave'. This patch fixes the issue by jumping to 'error' label where the proper clean up is already done. Signed-off-by: Andre Guedes --- a52/pcm_a52.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/a52/pcm_a52.c b/a52/pcm_a52.c index 29ce45f..e431fd0 100644 --- a/a52/pcm_a52.c +++ b/a52/pcm_a52.c @@ -978,7 +978,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(a52) if ((err = a52_set_hw_constraint(rec)) < 0) { snd_pcm_ioplug_delete(&rec->io); - return err; + goto error; } *pcmp = rec->io.pcm;