From patchwork Wed Jul 8 20:14:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 6750941 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 87E649F38C for ; Wed, 8 Jul 2015 20:15:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B61E92062B for ; Wed, 8 Jul 2015 20:15:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 87E92205FD for ; Wed, 8 Jul 2015 20:15:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0DDDC265ABD; Wed, 8 Jul 2015 22:15:12 +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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 03FE9265A81; Wed, 8 Jul 2015 22:15: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 2F820265A86; Wed, 8 Jul 2015 22:15:02 +0200 (CEST) Received: from smtp-out-104.synserver.de (smtp-out-104.synserver.de [212.40.185.104]) by alsa0.perex.cz (Postfix) with ESMTP id 933F5265A81 for ; Wed, 8 Jul 2015 22:14:55 +0200 (CEST) Received: (qmail 10694 invoked by uid 0); 8 Jul 2015 20:14:53 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 10569 Received: from ppp-188-174-59-27.dynamic.mnet-online.de (HELO lars-laptop.fritz.box) [188.174.59.27] by 217.119.54.81 with SMTP; 8 Jul 2015 20:14:52 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Date: Wed, 8 Jul 2015 22:14:48 +0200 Message-Id: <1436386488-5680-1-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 2.1.4 Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen Subject: [alsa-devel] [PATCH] ASoC: Free card DAPM context on snd_soc_instantiate_card() error path 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 Make sure the to free the card DAPM context if snd_soc_instantiate_card() fails, otherwise the memory allocated for the DAPM widgets is leaked. Signed-off-by: Lars-Peter Clausen --- sound/soc/soc-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2fc461c..8c8ce65 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1728,6 +1728,7 @@ card_probe_error: if (card->remove) card->remove(card); + snd_soc_dapm_free(&card->dapm); soc_cleanup_card_debugfs(card); snd_card_free(card->snd_card);