USB: usblcd, fix memory leak
authorJiri Slaby <jirislaby@gmail.com>
Wed, 23 Sep 2009 14:09:56 +0000 (16:09 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 9 Oct 2009 20:52:06 +0000 (13:52 -0700)
Stanse found a memory leak in lcd_probe. Instead of returning without
releasing the memory, jump to the error label which frees it.

http://stanse.fi.muni.cz/

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/misc/usblcd.c

index 29092b8..4fb1203 100644 (file)
@@ -313,7 +313,8 @@ static int lcd_probe(struct usb_interface *interface, const struct usb_device_id
 
        if (le16_to_cpu(dev->udev->descriptor.idProduct) != 0x0001) {
                dev_warn(&interface->dev, "USBLCD model not supported.\n");
-               return -ENODEV;
+               retval = -ENODEV;
+               goto error;
        }
        
        /* set up the endpoint information */