[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <s5h36iepzjc.wl-tiwai@suse.de>
Date: Tue, 06 Aug 2019 08:40:23 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Wenwen Wang <wenwen@...uga.edu>
Cc: "moderated list:SOUND" <alsa-devel@...a-project.org>,
Thomas Gleixner <tglx@...utronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kate Stewart <kstewart@...uxfoundation.org>,
Allison Randal <allison@...utok.net>,
Jaroslav Kysela <perex@...ex.cz>,
Richard Fontana <rfontana@...hat.com>,
Takashi Iwai <tiwai@...e.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ALSA: usb-audio: fix a memory leak bug
On Tue, 06 Aug 2019 08:13:06 +0200,
Wenwen Wang wrote:
>
> In add_new_ctl(), a mixer element structure is allocated through kzalloc()
> and the pointer is saved to 'elem'. Later on, a new alsa control element is
> created and added to this structure. In case the add process fails, i.e.,
> the return value of snd_usb_mixer_add_control() is less than 0, the
> allocated structure is not freed, leading to a memory leak.
>
> To fix the above issue, free 'elem' before returning the error.
>
> Signed-off-by: Wenwen Wang <wenwen@...uga.edu>
It's a false-positive. snd_ctl_add() behaves differently from others,
it releases the given kctl at the error. And in this case, elem
already gets freed by kctl->private_free callback.
thanks,
Takashi
Powered by blists - more mailing lists