Commit c15fc001 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

[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.
parent 75499ce6
......@@ -253,6 +253,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
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 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
// 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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment