Skip to content

Commit 57b138d

Browse files
Dan Carpentertiwai
authored andcommitted
ALSA: control - double free in snd_ctl_led_init()
"group - 1" was intended here instead of "group". The current error handling will double free the first item in the array and leak the last item. Fixes: cb17fe0 ("ALSA: control - add sysfs support to the LED trigger module") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Jaroslav Kysela <[email protected]> Link: https://lore.kernel.org/r/YHBJ4frGxErWB182@mwanda Signed-off-by: Takashi Iwai <[email protected]>
1 parent 64f40f9 commit 57b138d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sound/core/control_led.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ static int __init snd_ctl_led_init(void)
734734
if (device_add(&led->dev)) {
735735
put_device(&led->dev);
736736
for (; group > 0; group--) {
737-
led = &snd_ctl_leds[group];
737+
led = &snd_ctl_leds[group - 1];
738738
device_del(&led->dev);
739739
}
740740
device_del(&snd_ctl_led_dev);

0 commit comments

Comments
 (0)