USB: fix memleak in ark3116 serial driver
authorOliver Neukum <oliver@neukum.org>
Tue, 22 Jan 2008 13:24:56 +0000 (14:24 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 1 Feb 2008 22:35:04 +0000 (14:35 -0800)
in an error case memory already allocated must be freed again.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/ark3116.c

index ddfee918000dc5fd8b6b997d75a81625472821c4..fe2bfd67ba8e4717ef3b96657902663dbeedd22c 100644 (file)
@@ -151,8 +151,10 @@ static int ark3116_attach(struct usb_serial *serial)
        return 0;
 
 cleanup:
-       for (--i; i >= 0; --i)
+       for (--i; i >= 0; --i) {
+               kfree(usb_get_serial_port_data(serial->port[i]));
                usb_set_serial_port_data(serial->port[i], NULL);
+       }
        return -ENOMEM;
 }