提交 42ad1a03 编写于 作者: J Jia-Ju Bai 提交者: Jeff Kirsher

igb: Fix a memory leak in igb_probe

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: NJia-Ju Bai <baijiaju1990@163.com>
Tested-by: NAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 0845d45e
...@@ -2649,6 +2649,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2649,6 +2649,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (hw->flash_address) if (hw->flash_address)
iounmap(hw->flash_address); iounmap(hw->flash_address);
err_sw_init: err_sw_init:
kfree(adapter->shadow_vfta);
igb_clear_interrupt_scheme(adapter); igb_clear_interrupt_scheme(adapter);
pci_iounmap(pdev, hw->hw_addr); pci_iounmap(pdev, hw->hw_addr);
err_ioremap: err_ioremap:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册