patch-1.3.25 linux/drivers/net/3c505.c

Next file: linux/drivers/net/3c507.c
Previous file: linux/drivers/net/3c501.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.24/linux/drivers/net/3c505.c linux/drivers/net/3c505.c
@@ -1257,6 +1257,8 @@
 	 */
 	adapter = (elp_device *)(dev->priv = kmalloc(sizeof(elp_device), GFP_KERNEL));
 	CHECK_NULL(adapter);
+	if (adapter == NULL)
+		return -ENOMEM;
 	memset(&(adapter->stats), 0, sizeof(struct enet_statistics));
 
 	/*
@@ -1492,6 +1494,8 @@
 	else
 	{
 		unregister_netdev(&dev_3c505);
+		kfree(dev_3c505.priv);
+		dev_3c505.priv = NULL;
 
 		/* If we don't do this, we can't re-insmod it later. */
 		release_region(dev_3c505.base_addr, ELP_IO_EXTENT);

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