From patchwork Sat Aug 26 08:29:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: anish kumar X-Patchwork-Id: 9923253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ACA15602BD for ; Sat, 26 Aug 2017 08:29:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 982D12856B for ; Sat, 26 Aug 2017 08:29:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D2CB285C6; Sat, 26 Aug 2017 08:29:42 +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=-1.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no 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 D706A2856B for ; Sat, 26 Aug 2017 08:29:41 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0F423267440; Sat, 26 Aug 2017 10:29:40 +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 3F29226742D; Sat, 26 Aug 2017 10:29:36 +0200 (CEST) Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by alsa0.perex.cz (Postfix) with ESMTP id 4578D267439 for ; Sat, 26 Aug 2017 10:29:30 +0200 (CEST) Received: by mail-pg0-f68.google.com with SMTP id t3so2401385pgt.5 for ; Sat, 26 Aug 2017 01:29:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=dlilfTI/9jEgExsY7byswblpFE77BqvUq3XiwRkuI6s=; b=YkPrvGAfSq0o4kbXrHXiBYQThsIncBbtgC6PeeUXTOkVnVYDsBsoco/VgaklZCi6l1 Mw0pY1K6BKtrkOwoBUsDgwgsxPvZs4hLuHIPFwc03OVgnBlA6aW/KOwtzhP/8d+ut3qZ 1Oa3B+FnZvXPh7bRPksu98vAo2Xu2KCVt3Yx9Hc1h7XDkRrc/nLC50eoCRJfCLeftsfQ qjIXFzGv9ABhb5zwxys+e/JOAZKI2Mhd+k7xmSE55FHK9QJli8PRQv5aStoearLeOLS2 0Gg1o4BcBQyFylmdj4WHJLZuX4gzuM7/mKzzqbDyleevHZAyvniBY+zFZjkOyMWX6fKp vc5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=dlilfTI/9jEgExsY7byswblpFE77BqvUq3XiwRkuI6s=; b=LMU478avGHkNUneKce4dI2Sb/Y7iDEByx+H4KD8pLfTn2qj47f7klgu2FOCimD6NIc L3cwJXWuASJYgXZmyQuqt4XkESsu2I4wDc4pUUDl6PcYiEoc9aDEpzV2P6tYm/MQHZbl cGjKz7tDEpKK4zZTkaJDwBY6icVnZ1KR3ss41zmMI4zSIBDBH1bSzekYkz8e3PgsKcQj RakqX1aLrt6M4HyjgkDoLR6IfwLet9BcnIn0+xkAZbjuC4fJ60OELokbyxDIJ4Rgw5gz pqcfP/wJxYhIh8mfwhdcV1vSrmWXoquZWw7CrhjXYFHuDOyB7tWqE6ZpMBFtzwiwfYAt TJrw== X-Gm-Message-State: AHYfb5hDa9vgH+rxlEE5S3nHszpi2Y3n8q7beol/z6ADz94caS8qDFvV bLAvRsjD+nf7ZA== X-Received: by 10.101.76.5 with SMTP id u5mr1108220pgq.119.1503736169259; Sat, 26 Aug 2017 01:29:29 -0700 (PDT) Received: from AIKUMA-MBP.hsd1.ca.comcast.net. ([24.6.106.169]) by smtp.googlemail.com with ESMTPSA id m3sm10764489pfm.107.2017.08.26.01.29.27 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 26 Aug 2017 01:29:28 -0700 (PDT) From: anish kumar To: broonie@kernel.org Date: Sat, 26 Aug 2017 01:29:25 -0700 Message-Id: <20170826082925.35472-1-yesanishhere@gmail.com> X-Mailer: git-send-email 2.10.1 (Apple Git-78) Cc: anish kumar , alsa-devel@alsa-project.org, tiwai@suse.com, lgirdwood@gmail.com Subject: [alsa-devel] [patch 1/4] ASoC: dapm: fix error path in snd_soc_dapm_new_pcm 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 Before freeing the memory, check if it was allcoated. Signed-off-by: anish kumar --- sound/soc/soc-dapm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index dcef67a..6e10a9a 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3907,9 +3907,10 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, devm_kfree(card->dev, (void *)private_value); outfree_link_name: devm_kfree(card->dev, link_name); -outfree_w_param: for (count = 0 ; count < num_params; count++) - devm_kfree(card->dev, (void *)w_param_text[count]); + if (w_param_text[count]) + devm_kfree(card->dev, (void *)w_param_text[count]); +outfree_w_param: devm_kfree(card->dev, w_param_text); return ret;