Patchwork fix memory leak in drivers/net/netxen_nic_init.c

login
register
mail settings
Submitter Daniel Marjamäki
Date Jan. 29, 2009, 6:55 p.m.
Message ID <200901291955.56832.danielm77@spray.se>
Download mbox | patch
Permalink /patch/21054/
State Accepted
Delegated to: David Miller
Headers show

Comments

Daniel Marjamäki - Jan. 29, 2009, 6:55 p.m.
From: Daniel Marjamäki <danielm77@spray.se>

For kernel bugzilla #12537:
http://bugzilla.kernel.org/show_bug.cgi?id=12537

Free memory.

Signed-off-by: Daniel Marjamäki <danielm77@spray.se>
Reported-by: Daniel Marjamäki <danielm77@spray.se>
---




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index ca7c8d8..ffd37be 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -947,8 +947,10 @@  int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
 	}
 	for (i = 0; i < n; i++) {
 		if (netxen_rom_fast_read(adapter, 8*i + 4*offset, &val) != 0 ||
-		netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0)
+		netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) {
+			kfree(buf);
 			return -EIO;
+		}

 		buf[i].addr = addr;
 		buf[i].data = val;