netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix airo memory leak
@ 2003-08-02 15:43 Daniel Ritz
  0 siblings, 0 replies; only message in thread
From: Daniel Ritz @ 2003-08-02 15:43 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-net, linux-netdev

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-02 15:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-02 15:43 [PATCH] fix airo memory leak Daniel Ritz

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).