All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: alan@redhat.com, linux-kernel@vger.kernel.org, greg@kroah.com,
	david-b@pacbell.net, wahrenbruch@kobil.de,
	torvalds@transmeta.com
Subject: Memleak in KOBIL USB Smart Card Terminal Driver
Date: Wed, 12 Mar 2003 23:00:50 +0300	[thread overview]
Message-ID: <20030312200050.GA28090@linuxhacker.ru> (raw)

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;
 	} 
 

             reply	other threads:[~2003-03-12 19:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-12 20:00 Oleg Drokin [this message]
2003-03-14 18:32 ` Memleak in KOBIL USB Smart Card Terminal Driver Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030312200050.GA28090@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=alan@redhat.com \
    --cc=david-b@pacbell.net \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=wahrenbruch@kobil.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.