public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: alan@redhat.com, linux-kernel@vger.kernel.org, marcelo@conectiva.com.br
Subject: [2.4] Memleak in Aironet 4500 Pcmcia driver
Date: Tue, 22 Apr 2003 23:45:28 +0400	[thread overview]
Message-ID: <20030422194528.GA7471@linuxhacker.ru> (raw)

Hello!

   There is a memleak in Aironet 4500 Pcmcia driver on error exit path
   that is trivial to fix.
   Please consider following path.
   Found with help of smatch's unfree script.

Bye,
    Oleg
===== drivers/net/pcmcia/aironet4500_cs.c 1.8 vs edited =====
--- 1.8/drivers/net/pcmcia/aironet4500_cs.c	Wed Aug  7 22:27:37 2002
+++ edited/drivers/net/pcmcia/aironet4500_cs.c	Tue Apr 22 23:40:53 2003
@@ -282,7 +282,7 @@
 	};
 	memset(dev,0,sizeof(struct net_device));
 	dev->priv = kmalloc(sizeof(struct awc_private), GFP_KERNEL);
-	if (!dev->priv ) {printk(KERN_CRIT "out of mem on dev priv alloc \n"); return NULL;};
+	if (!dev->priv ) {printk(KERN_CRIT "out of mem on dev priv alloc \n"); kfree(dev); return NULL;};
 	memset(dev->priv,0,sizeof(struct awc_private));
 	
 //	link->dev->minor = dev->minor;

                 reply	other threads:[~2003-04-22 19:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030422194528.GA7471@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox