Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2425099yba; Sun, 28 Apr 2019 00:13:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzFkMN56iIEYuparkSsHWIizRs3B906sJgGT+cEqD9QtoTlmIxnkzKvTqABtm3Cp48GDJx X-Received: by 2002:aa7:8ad2:: with SMTP id b18mr781764pfd.232.1556435631905; Sun, 28 Apr 2019 00:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556435631; cv=none; d=google.com; s=arc-20160816; b=BJJ/P7uLNl8V6tmZHDVnhSq8lcH57yLEC/GiEKYsf6Ibc8HZtOsyiwkGZSK+kORmZi uUewqPxR/M1TrdAW2vTkjJrfiGZYYvFbBzn0CpwWipTkGGfYL5U+VXxT/aVPvWeSyw2/ 3OoTW0VkFbUta+PAjoXXjL0ihxmApxkfeJfq4MXoP+cUbSu/ilMIGBIAHl0Hj7zY/fTs 2Z2rVtI+DUKGsyXHUXBtvX8U1ljRnbWMN1+IGo3+2xU+GpLppniOOGVcRf9VtMu28nn3 tJI8ITeYiTdGye+fTtnnlkZsuADBvXEdyd1UY/7pRDpWk0/DxmR1r2oqH4WdILSMJDwV ngDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=i/Xohcd5L+Y7Gr8M14C3kiAD8/crS5l99XcnccHPyYQ=; b=YGmqEeGs6JO9gZrFMOvyUQhUl1vKS5DDtDOnFRRHJCyTC23LbTj5+BFXz/PWf+m76O ETO6b9uUs7+hMogAtTXFsRRH52YLpcOZA6b/U9G1pKO7Rz8opk1BaDSQzmJfFriAaEDd Amw/F6Ex/7EVO1J3MWGtStwMdaDYjFhQdLSlgOuzpdoFRHdjqlkOgDB3HBDNbEDp52ih Z5+l0jF52toxlkjNXZIlNcPQ1bVrThgZsUlq9A66virSOE7eAU8nc5ctVYkBw+0JoPja iVSOZq5W679MRHgBAjM2/ZcMkqzETrOaNN77F+EpjFKmXStecwTF+tVdA1rVJb38IX2f 9BYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si28180645pgh.516.2019.04.28.00.13.36; Sun, 28 Apr 2019 00:13:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726573AbfD1HMR (ORCPT + 99 others); Sun, 28 Apr 2019 03:12:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:37132 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726133AbfD1HMQ (ORCPT ); Sun, 28 Apr 2019 03:12:16 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 94436AD63; Sun, 28 Apr 2019 07:12:15 +0000 (UTC) Date: Sun, 28 Apr 2019 09:12:15 +0200 Message-ID: From: Takashi Iwai To: "Wenwen Wang" Cc: "moderated list:SOUND" , "Jorge Sanjuan" , "Ruslan Bilovol" , "Jaroslav Kysela" , "open list" Subject: Re: [PATCH] ALSA: usb-audio: Fix a memory leak bug In-Reply-To: <1556345208-1210-1-git-send-email-wang6495@umn.edu> References: <1556345208-1210-1-git-send-email-wang6495@umn.edu> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 27 Apr 2019 08:06:46 +0200, Wenwen Wang wrote: > > In parse_audio_selector_unit(), the string array 'namelist' is allocated > through kmalloc_array(), and each string pointer in this array, i.e., > 'namelist[]', is allocated through kmalloc() in the following for loop. > Then, a control instance 'kctl' is created by invoking snd_ctl_new1(). If > an error occurs during the creation process, the string array 'namelist', > including all string pointers in the array 'namelist[]', should be freed, > before the error code ENOMEM is returned. However, the current code does > not free 'namelist[]', resulting in memory leaks. > > To fix the above issue, free all string pointers 'namelist[]' in a loop. > > Signed-off-by: Wenwen Wang Applied now, thanks. Takashi