Bug 12537 - drivers/net/netxen/netxen_nic_init.c:951: Memory leak: buf
Summary: drivers/net/netxen/netxen_nic_init.c:951: Memory leak: buf
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Network (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Daniel Marjamäki
URL:
Keywords:
Depends on:
Blocks:
 
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
Subsystem:
Regression: ---
Bisected commit-id:


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.