From: Mariusz Kozlowski Date: Mon, 8 Jan 2007 10:25:30 +0000 (+0100) Subject: [ALSA] usb: usbmixer error path fix X-Git-Tag: v2.6.20-rc5~32^2~2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fbe3ca571e4b0795b729658e3d76824be54cb18;p=linux-2.6 [ALSA] usb: usbmixer error path fix Without the patch below namelist[0] will not be freed in case of kmalloc error. Signed-off-by: Mariusz Kozlowski Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index e74eb1bc8d..7b3bf3545a 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c @@ -1526,7 +1526,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, unsi namelist[i] = kmalloc(MAX_ITEM_NAME_LEN, GFP_KERNEL); if (! namelist[i]) { snd_printk(KERN_ERR "cannot malloc\n"); - while (--i > 0) + while (i--) kfree(namelist[i]); kfree(namelist); kfree(cval);