Bug 12537 - drivers/net/netxen/netxen_nic_init.c:951: Memory leak: buf
drivers/net/netxen/netxen_nic_init.c:951: Memory leak: buf
Status: CLOSED CODE_FIX
Product: Drivers
Classification: Unclassified
Component: Network
All Linux
: P1 normal
Assigned To: Daniel Marjamäki
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-25 03:06 UTC by Daniel Marjamäki
Modified: 2009-01-30 02:28 UTC (History)
0 users

See Also:
Kernel Version: latest git tree
Tree: Mainline
Regression: ---


Attachments

Description Daniel Marjamäki 2009-01-25 03:06:12 UTC
In the function netxen_pinit_from_rom there is this code...

	buf = kcalloc(n, sizeof(struct crb_addr_pair), GFP_KERNEL);
	if (buf == NULL) {
		printk("%s: netxen_pinit_from_rom: Unable to calloc memory.\n",
				netxen_nic_driver_name);
		return -ENOMEM;
	}
	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)
			return -EIO;

There should be a kfree of buf before the "return -EIO".

This bug was found with cppcheck - http://cppcheck.wiki.sourceforge.net/
Comment 1 Daniel Marjamäki 2009-01-30 02:28:54 UTC
Patch submitted and applied

Note You need to log in before you can comment on or make changes to this bug.