Skip to content

Commit

Permalink
USB: fix memleak in ark3116 serial driver
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Feb 1, 2008
1 parent 9e3b1d8 commit 004b4f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/serial/ark3116.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 004b4f2

Please sign in to comment.