Hi,
Take a look and consider applying.
- Arnaldo
--- linux-2.4.0-test7-pre2/drivers/net/wan/lapbether.c Thu May 4 15:31:21 2000
+++ linux-2.4.0-test7-pre2.acme/drivers/net/wan/lapbether.c Sun Aug 13 00:36:13 2000
@@ -16,6 +16,11 @@
*
* History
* LAPBETH 001 Jonathan Naylor Cloned from bpqether.c
+ *
+ * Fixes:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/13/2000
+ * - release previously allocated resources in lapbeth_new_device on
+ * failure
*/
#include <linux/errno.h>
@@ -409,7 +414,7 @@
*/
static int lapbeth_new_device(struct net_device *dev)
{
- int k;
+ int k, ret = -ENOMEM;
unsigned char *buf;
struct lapbethdev *lapbeth, *lapbeth2;
@@ -426,6 +431,9 @@
dev = &lapbeth->axdev;
buf = kmalloc(14, GFP_KERNEL);
+ if (!buf)
+ goto cleanup_lapbeth;
+
for (k = 0; k < MAXLAPBDEV; k++) {
struct net_device *odev;
@@ -436,17 +444,18 @@
}
if (k == MAXLAPBDEV) {
- kfree(lapbeth);
- return -ENODEV;
+ ret = -ENODEV;
+ goto cleanup_buf;
}
dev->priv = (void *)lapbeth; /* pointer back */
strcpy(dev->name, buf);
+ kfree(buf);
dev->init = lapbeth_dev_init;
if (register_netdev(dev) != 0) {
- kfree(lapbeth);
- return -EIO;
+ ret = -EIO;
+ goto cleanup_lapbeth;
}
dev_init_buffers(dev);
@@ -477,6 +486,9 @@
sti();
return 0;
+cleanup_buf: kfree(buf);
+cleanup_lapbeth: kfree(lapbeth);
+ return ret;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:29 EST