From patchwork Fri Sep 28 21:27:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guedes, Andre" X-Patchwork-Id: 10620331 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 E7614913 for ; Fri, 28 Sep 2018 21:28:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6ECC2BF4C for ; Fri, 28 Sep 2018 21:28:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C978C2BF63; Fri, 28 Sep 2018 21:28:11 +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 5B0C12BF4C for ; Fri, 28 Sep 2018 21:28:11 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 34FAA2678CE; Fri, 28 Sep 2018 23:28:03 +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 1235A2678CD; 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 1119B2678C5 for ; Fri, 28 Sep 2018 23:27:56 +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="87635621" Received: from aguedesl-mobl1.jf.intel.com ([10.251.19.131]) by orsmga003.jf.intel.com with ESMTP; 28 Sep 2018 14:27:52 -0700 From: Andre Guedes To: alsa-devel@alsa-project.org Date: Fri, 28 Sep 2018 14:27:25 -0700 Message-Id: <20180928212727.15151-3-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 2/4] jack: Fix leaks when jack_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 jack_set_hw_constraint() returns error, we leak the 'jack' object and all the resources referenced by it. This patch fixes the issue by calling snd_pcm_jack_free() before returning. Signed-off-by: Andre Guedes --- jack/pcm_jack.c | 1 + 1 file changed, 1 insertion(+) diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c index b39835e..6aaecac 100644 --- a/jack/pcm_jack.c +++ b/jack/pcm_jack.c @@ -538,6 +538,7 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name, err = jack_set_hw_constraint(jack); if (err < 0) { snd_pcm_ioplug_delete(&jack->io); + snd_pcm_jack_free(jack); return err; }