]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
qlcnic: Memory leak fix
authorSony Chacko <sony.chacko@qlogic.com>
Fri, 1 Apr 2011 14:27:59 +0000 (14:27 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Apr 2011 19:47:10 +0000 (12:47 -0700)
Fix a memory leak in error path of pci info.

Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/qlcnic/qlcnic_main.c

index d230fdde28af854e35c6a59f5b5e5fdc38e13f73..de6f86681a3c57b6b35f480eb446d9fe33e63657 100644 (file)
@@ -464,8 +464,10 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
 
        for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
                pfn = pci_info[i].id;
-               if (pfn > QLCNIC_MAX_PCI_FUNC)
-                       return QL_STATUS_INVALID_PARAM;
+               if (pfn > QLCNIC_MAX_PCI_FUNC) {
+                       ret = QL_STATUS_INVALID_PARAM;
+                       goto err_eswitch;
+               }
                adapter->npars[pfn].active = (u8)pci_info[i].active;
                adapter->npars[pfn].type = (u8)pci_info[i].type;
                adapter->npars[pfn].phy_port = (u8)pci_info[i].default_port;