igb: Fix a memory leak in igb_probe
authorJia-Ju Bai <baijiaju1990@163.com>
Wed, 5 Aug 2015 14:05:16 +0000 (22:05 +0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 18 Aug 2015 21:06:06 +0000 (14:06 -0700)
In error handling code of igb_probe, the memory adapter->shadow_vfta
allocated by kcalloc in igb_sw_init is not freed. So when register_netdev
or igb_init_i2c is failed, a memory leak will occur.
This patch adds kfree to fix it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/igb/igb_main.c

index 17c1c84..1ebdb46 100644 (file)
@@ -2649,6 +2649,7 @@ err_eeprom:
        if (hw->flash_address)
                iounmap(hw->flash_address);
 err_sw_init:
+       kfree(adapter->shadow_vfta);
        igb_clear_interrupt_scheme(adapter);
        pci_iounmap(pdev, hw->hw_addr);
 err_ioremap: