Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752682AbbHEOFg (ORCPT ); Wed, 5 Aug 2015 10:05:36 -0400 Received: from m12-18.163.com ([220.181.12.18]:36643 "EHLO m12-18.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751486AbbHEOFf (ORCPT ); Wed, 5 Aug 2015 10:05:35 -0400 From: Jia-Ju Bai To: jeffrey.t.kirsher@intel.com, jesse.brandeburg@intel.com Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] igb: Fix a memory leak in igb_probe Date: Wed, 5 Aug 2015 22:05:16 +0800 Message-Id: <1438783516-13283-1-git-send-email-baijiaju1990@163.com> X-Mailer: git-send-email 1.7.9.5 X-CM-TRANSID: EsCowEAJwEMcGMJVNiyCAg--.20474S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrZrWxXr4fJFW3Zr45XF4fXwb_yoWfWrb_uw 12vFWxJanxGw1Fkw4Yyr42v3yq9r1v9ryfAr4akFWSkwn7Cw17Ww1DZr13XrZ5WrWfCasr Cr1agFy2y34jkjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUj6pBDUUUUU== X-Originating-IP: [166.111.70.58] X-CM-SenderInfo: xedlyx5dmximizq6il2tof0z/xtbBRQNNelO-wXjiNgAAsw Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1076 Lines: 31 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 --- drivers/net/ethernet/intel/igb/igb_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 2f70a9b..3efb757 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -2645,6 +2645,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: -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/