From: Takashi Iwai <tiwai@suse.de>
To: Wenwen Wang <wenwen@cs.uga.edu>
Cc: "moderated list:SOUND" <alsa-devel@alsa-project.org>,
Thomas Gleixner <tglx@linutronix.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kate Stewart <kstewart@linuxfoundation.org>,
Allison Randal <allison@lohutok.net>,
Jaroslav Kysela <perex@perex.cz>,
Richard Fontana <rfontana@redhat.com>,
Takashi Iwai <tiwai@suse.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ALSA: usb-audio: fix a memory leak bug
Date: Tue, 06 Aug 2019 08:40:23 +0200 [thread overview]
Message-ID: <s5h36iepzjc.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAAa=b7eiG_rpjfL8c-dWjpxSf3XPJxJbcVPrE1W0_1j-9s1QEg@mail.gmail.com>
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@cs.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
next prev parent reply other threads:[~2019-08-06 6:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 6:13 Wenwen Wang
2019-08-06 6:40 ` Takashi Iwai [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-08-06 7:00 Wenwen Wang
2019-08-06 10:47 ` Takashi Iwai
2019-04-27 6:06 [PATCH] ALSA: usb-audio: Fix " Wenwen Wang
2019-04-28 7:12 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5h36iepzjc.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=allison@lohutok.net \
--cc=alsa-devel@alsa-project.org \
--cc=gregkh@linuxfoundation.org \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=rfontana@redhat.com \
--cc=tglx@linutronix.de \
--cc=tiwai@suse.com \
--cc=wenwen@cs.uga.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®