netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Ritz <daniel.ritz@gmx.ch>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-net <linux-net@vger.kernel.org>,
	"linux-netdev" <netdev@oss.sgi.com>
Subject: [PATCH] fix airo memory leak
Date: Sat, 2 Aug 2003 17:43:12 +0200	[thread overview]
Message-ID: <200308021743.12635.daniel.ritz@gmx.ch> (raw)

fixes a memory leak: memory for the airo_devices list is allocated but
never freed.

against 2.6.0-test2-bk, but should apply to 2.4 as well...



--- 1.54/drivers/net/wireless/airo.c	Sun Jul 20 05:17:02 2003
+++ edited/drivers/net/wireless/airo.c	Sat Aug  2 17:33:24 2003
@@ -4038,12 +4038,23 @@
 	return 0;
 }
 
-static void del_airo_dev( struct net_device *dev ) {
-	struct net_device_list **p = &airo_devices;
-	while( *p && ( (*p)->dev != dev ) )
-		p = &(*p)->next;
-	if ( *p && (*p)->dev == dev )
-		*p = (*p)->next;
+static void del_airo_dev(struct net_device *dev)
+{
+	struct net_device_list *this = airo_devices, *prev = NULL;
+
+	while (this) {
+		if (this->dev == dev) {
+			if (prev)
+				prev->next = this->next;
+			else
+				airo_devices = this->next;
+			kfree(this);
+			break;	
+		}
+
+		prev = this;
+		this = this->next;
+	}
 }
 
 #ifdef CONFIG_PCI

                 reply	other threads:[~2003-08-02 15:43 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=200308021743.12635.daniel.ritz@gmx.ch \
    --to=daniel.ritz@gmx.ch \
    --cc=jgarzik@pobox.com \
    --cc=linux-net@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    /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;
as well as URLs for NNTP newsgroup(s).