From patchwork Mon Sep 17 08:26:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 10602221 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 512BD6CB for ; Mon, 17 Sep 2018 08:45:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40490295CA for ; Mon, 17 Sep 2018 08:45:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32F1C2965F; Mon, 17 Sep 2018 08:45:48 +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 EBFA429651 for ; Mon, 17 Sep 2018 08:45:46 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 331B426787E; Mon, 17 Sep 2018 10:26:20 +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 8661126787F; Mon, 17 Sep 2018 10:26:17 +0200 (CEST) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by alsa0.perex.cz (Postfix) with ESMTP id 9124626780A for ; Mon, 17 Sep 2018 10:26:15 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id p5-v6so7068559plk.3 for ; Mon, 17 Sep 2018 01:26:15 -0700 (PDT) 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=9GWYmVxflaaMWGFG31MOyMWRNsyfZLQEXFmV5oJLZPg=; b=mvUA6cRPNcENyvq+/nmnYeuAuiLpMx2Kq8WSsusKYw7si8IfcToS7c94NxvnjG8JCs L2xOzSK+p1hnLMOZaNDEpDjquDem3WK8jCiwV9RKfBT4PZVKgieAhpivhC70TKlbQEqs bjn5BjCly0Jmnsx2Lx93IZmul3PlUb5JeH161kV1AwPm/IEqc0LUX/DR+jiS1rkKQo/7 4UxUMWXpVUon1Hk0qKj9AP28CkQ/b7mf/sIvrIWwQGnw02Fl+0GQ0a2htZvqrNz1R5aF B+hm+Fq+M4hRhlq7hZa7LvHj11SSKhNVLti+uzWm7N6gS9BYYFJFqhKXY59QUBKaxxKV VqtQ== X-Gm-Message-State: APzg51CF+K9KMdwBSonCbn1+UK0MvaC17us0ofNwhEyXwJlRwMY0wRbN u1aDqOfSoyB8ntZV7GSE+/LKN3kA X-Google-Smtp-Source: ANB0Vdav0t7xJmn0nxRZg3k6dvEICjMQ6+hxlOgY0cgq3Fss37cK816RbwRKAV8AoYD73dbZf1xfmQ== X-Received: by 2002:a17:902:7606:: with SMTP id k6-v6mr23392260pll.300.1537172774698; Mon, 17 Sep 2018 01:26:14 -0700 (PDT) Received: from localhost.localdomain ([2405:6580:9660:3200:60c7:933c:fe9f:29ca]) by smtp.gmail.com with ESMTPSA id 6-v6sm22387256pfs.58.2018.09.17.01.26.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Sep 2018 01:26:13 -0700 (PDT) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Mon, 17 Sep 2018 17:26:08 +0900 Message-Id: <20180917082608.11472-1-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.17.1 Cc: alsa-devel@alsa-project.org, stable@vger.kernel.org Subject: [alsa-devel] [PATCH] ALSA: oxfw: fix memory leak for model-dependent data at 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 After allocating model-dependent data, ALSA OXFW driver has memory leak of the data at error path. This commit releases the data at the error path. Fixes: 6c29230e2a5f ('ALSA: oxfw: delayed registration of sound card') Cc: # v4.7+ Signed-off-by: Takashi Sakamoto --- sound/firewire/oxfw/oxfw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c index 63b3e1ce986e..9c8c527ebff9 100644 --- a/sound/firewire/oxfw/oxfw.c +++ b/sound/firewire/oxfw/oxfw.c @@ -277,6 +277,8 @@ static void do_registration(struct work_struct *work) oxfw->rx_stream_formats[i] = NULL; } snd_card_free(oxfw->card); + kfree(oxfw->spec); + oxfw->spec = NULL; dev_info(&oxfw->unit->device, "Sound card registration failed: %d\n", err); }