patch-1.3.25 linux/drivers/net/dummy.c

Next file: linux/drivers/net/eepro.c
Previous file: linux/drivers/net/depca.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.24/linux/drivers/net/dummy.c linux/drivers/net/dummy.c
@@ -88,6 +88,8 @@
 
 #if DUMMY_STATS
 	dev->priv = kmalloc(sizeof(struct enet_statistics), GFP_KERNEL);
+	if (dev->priv == NULL)
+		return -ENOMEM;
 	memset(dev->priv, 0, sizeof(struct enet_statistics));
 	dev->get_stats		= dummy_get_stats;
 #endif
@@ -170,6 +172,8 @@
 	else
 	{
 		unregister_netdev(&dev_dummy);
+		kfree(dev_dummy.priv);
+		dev_dummy.priv = NULL;
 	}
 }
 #endif /* MODULE */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this