From: Takashi Iwai <tiwai@suse.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: onkel@paraair.de, alsa-devel@alsa-project.org
Subject: Re: [PATCH 4/5] ALSA: usb-audio: deallocate memory objects in error path
Date: Mon, 20 Feb 2017 21:49:19 +0100 [thread overview]
Message-ID: <s5hwpckpoz4.wl-tiwai@suse.de> (raw)
In-Reply-To: <20170220200921.824-5-o-takashi@sakamocchi.jp>
On Mon, 20 Feb 2017 21:09:20 +0100,
Takashi Sakamoto wrote:
>
> Some functions for quirks of Tascam US-16x08 have memory leaks.
>
> This commit fixes the bugs.
>
> Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk")
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> ---
> sound/usb/mixer_us16x08.c | 27 ++++++++++++++++-----------
> 1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/sound/usb/mixer_us16x08.c b/sound/usb/mixer_us16x08.c
> index 5dae63c..d34dd1c 100644
> --- a/sound/usb/mixer_us16x08.c
> +++ b/sound/usb/mixer_us16x08.c
> @@ -1082,8 +1082,8 @@ static int add_new_ctl(struct usb_mixer_interface *mixer,
>
> kctl = snd_ctl_new1(ncontrol, elem);
> if (!kctl) {
> - kfree(elem);
> - return -ENOMEM;
> + err = -ENOMEM;
> + goto end;
> }
>
> kctl->private_free = freeer;
> @@ -1092,11 +1092,12 @@ static int add_new_ctl(struct usb_mixer_interface *mixer,
>
> err = snd_usb_mixer_add_control(&elem->head, kctl);
> if (err < 0)
> - return err;
> + goto end;
>
> if (elem_ret)
> *elem_ret = elem;
> -
> +end:
> + kfree(elem);
> return 0;
This will release elem even for the success case, no?
Takashi
next prev parent reply other threads:[~2017-02-20 20:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-20 20:09 [PATCH 0/5] ALSA: usb-audio: fixes for quirks of Tascam US-16x08 Takashi Sakamoto
2017-02-20 20:09 ` [PATCH 1/5] ALSA: usb-audio: localize one-referrer variable Takashi Sakamoto
2017-02-20 20:51 ` Takashi Iwai
2017-02-20 20:09 ` [PATCH 2/5] ALSA: usb-audio: purge needless variable length array Takashi Sakamoto
2017-02-20 20:51 ` Takashi Iwai
2017-02-20 21:04 ` Takashi Iwai
2017-02-21 2:23 ` Takashi Sakamoto
2017-02-20 20:09 ` [PATCH 3/5] ALSA: usb-audio: localize function without external linkage Takashi Sakamoto
2017-02-20 20:52 ` Takashi Iwai
2017-02-20 20:09 ` [PATCH 4/5] ALSA: usb-audio: deallocate memory objects in error path Takashi Sakamoto
2017-02-20 20:49 ` Takashi Iwai [this message]
2017-02-21 2:32 ` Takashi Sakamoto
2017-02-21 22:45 ` Takashi Sakamoto
2017-02-21 22:59 ` Takashi Sakamoto
2017-02-22 1:42 ` Takashi Sakamoto
2017-02-22 7:44 ` Takashi Iwai
2017-02-22 7:46 ` Takashi Iwai
2017-02-22 13:37 ` Takashi Sakamoto
2017-02-22 14:05 ` Takashi Iwai
2017-02-22 13:20 ` Takashi Sakamoto
2017-02-20 20:09 ` [PATCH 5/5] ALSA: usb-audio: fix msleep timeout due to minimum resolution of task scheduling Takashi Sakamoto
2017-02-20 20:51 ` 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=s5hwpckpoz4.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=o-takashi@sakamocchi.jp \
--cc=onkel@paraair.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.