From 004b4f2d4448cff7f13871c05d744b00a7c74d4a Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Tue, 22 Jan 2008 14:24:56 +0100 Subject: USB: fix memleak in ark3116 serial driver in an error case memory already allocated must be freed again. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ark3116.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/usb/serial/ark3116.c') diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index ddfee918000..fe2bfd67ba8 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -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; } -- cgit v1.2.3-70-g09d2