Skip to content

Commit 14d8114

Browse files
committed
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: 1052d98 ("ALSA: control: Use automatic cleanup of kfree()") Reported-by: Mirsad 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: Takashi Iwai <tiwai@suse.de>
1 parent 33affa7 commit 14d8114

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sound/core/control.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,12 +1275,12 @@ static int snd_ctl_elem_read(struct snd_card *card,
12751275
static int snd_ctl_elem_read_user(struct snd_card *card,
12761276
struct snd_ctl_elem_value __user *_control)
12771277
{
1278-
struct snd_ctl_elem_value *control;
1278+
struct snd_ctl_elem_value *control __free(kfree) = NULL;
12791279
int result;
12801280

12811281
control = memdup_user(_control, sizeof(*control));
12821282
if (IS_ERR(control))
1283-
return PTR_ERR(control);
1283+
return PTR_ERR(no_free_ptr(control));
12841284

12851285
result = snd_ctl_elem_read(card, control);
12861286
if (result < 0)

0 commit comments

Comments
 (0)