USB: fix memleak in ark3116 serial driver

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>
This commit is contained in:
Oliver Neukum 2008-01-22 14:24:56 +01:00 committed by Greg Kroah-Hartman
parent 9e3b1d8e3d
commit 004b4f2d44

View 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;
}