ChangeSet 1.1094.6.8, 2003/03/14 10:43:24-08:00, green@linuxhacker.ru [PATCH] Memleak in KOBIL USB Smart Card Terminal Driver There is a memleak on error exit path in KOBIL USB Smart Card Terminal Driver in both current 2.4 and 2.5. See the patch. Found with help of smatch + enhanced unfree script. drivers/usb/serial/kobil_sct.c | 2 ++ 1 files changed, 2 insertions(+) diff -Nru a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c --- a/drivers/usb/serial/kobil_sct.c Mon Mar 17 11:46:43 2003 +++ b/drivers/usb/serial/kobil_sct.c Mon Mar 17 11:46:43 2003 @@ -253,6 +253,7 @@ port->write_urb = usb_alloc_urb(0, GFP_KERNEL); if (!port->write_urb) { dbg("%s - port %d usb_alloc_urb failed", __FUNCTION__, port->number); + kfree(transfer_buffer); return -1; } } @@ -260,6 +261,7 @@ // allocate memory for write_urb transfer buffer port->write_urb->transfer_buffer = (unsigned char *) kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL); if (! port->write_urb->transfer_buffer) { + kfree(transfer_buffer); return -1; }