public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Memleak in KOBIL USB Smart Card Terminal Driver
@ 2003-03-12 20:00 Oleg Drokin
  2003-03-14 18:32 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Drokin @ 2003-03-12 20:00 UTC (permalink / raw)
  To: alan, linux-kernel, greg, david-b, wahrenbruch, torvalds

Hello!

   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.

Bye,
    Oleg

===== drivers/usb/serial/kobil_sct.c 1.2 vs edited =====
--- 1.2/drivers/usb/serial/kobil_sct.c	Wed Dec 11 03:31:09 2002
+++ edited/drivers/usb/serial/kobil_sct.c	Wed Mar 12 22:57:33 2003
@@ -254,6 +254,7 @@
 		port->write_urb = usb_alloc_urb(0);  
 		if (!port->write_urb) {
 			dbg("%s - port %d usb_alloc_urb failed", __FUNCTION__, port->number);
+			kfree(transfer_buffer);
 			return -1;
 		}
 	}
@@ -261,6 +262,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;
 	} 
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Memleak in KOBIL USB Smart Card Terminal Driver
  2003-03-12 20:00 Memleak in KOBIL USB Smart Card Terminal Driver Oleg Drokin
@ 2003-03-14 18:32 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2003-03-14 18:32 UTC (permalink / raw)
  To: Oleg Drokin; +Cc: alan, linux-kernel, david-b, wahrenbruch, torvalds

On Wed, Mar 12, 2003 at 11:00:50PM +0300, Oleg Drokin wrote:
> Hello!
> 
>    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.

Applied to both my 2.4 and 2.5 trees, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-14 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-12 20:00 Memleak in KOBIL USB Smart Card Terminal Driver Oleg Drokin
2003-03-14 18:32 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox