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 ddfee91..fe2bfd6 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;
 }