Commit 14d81146 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: control: Fix unannotated kfree() cleanup

The recent conversion to the automatic kfree() forgot to mark a
variable with __free(kfree), leading to memory leaks.  Fix it.

Fixes: 1052d988 ("ALSA: control: Use automatic cleanup of kfree()")
Reported-by: default avatarMirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Closes: https://lore.kernel.org/r/c1e2ef3c-164f-4840-9b1c-f7ca07ca422a@alu.unizg.hr
Message-ID: <20240320062722.31325-1-tiwai@suse.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 33affa7f
...@@ -1275,12 +1275,12 @@ static int snd_ctl_elem_read(struct snd_card *card, ...@@ -1275,12 +1275,12 @@ static int snd_ctl_elem_read(struct snd_card *card,
static int snd_ctl_elem_read_user(struct snd_card *card, static int snd_ctl_elem_read_user(struct snd_card *card,
struct snd_ctl_elem_value __user *_control) struct snd_ctl_elem_value __user *_control)
{ {
struct snd_ctl_elem_value *control; struct snd_ctl_elem_value *control __free(kfree) = NULL;
int result; int result;
control = memdup_user(_control, sizeof(*control)); control = memdup_user(_control, sizeof(*control));
if (IS_ERR(control)) if (IS_ERR(control))
return PTR_ERR(control); return PTR_ERR(no_free_ptr(control));
result = snd_ctl_elem_read(card, control); result = snd_ctl_elem_read(card, control);
if (result < 0) if (result < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment