vxge: Fix a possible memory leak in vxge_hw_device_initialize().
Sreenivasa Honnur [Thu, 8 Apr 2010 08:44:39 +0000 (01:44 -0700)]
- Fix a possible memory leak in vxge_hw_device_initialize(). Free hldev if
vxge_hw_device_reg_addr_get() fails.

Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@exar.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@exar.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

drivers/net/vxge/vxge-config.c

index ec4408c..66dd589 100644 (file)
@@ -634,8 +634,10 @@ vxge_hw_device_initialize(
        __vxge_hw_device_pci_e_init(hldev);
 
        status = __vxge_hw_device_reg_addr_get(hldev);
-       if (status != VXGE_HW_OK)
+       if (status != VXGE_HW_OK) {
+               vfree(hldev);
                goto exit;
+       }
        __vxge_hw_device_id_get(hldev);
 
        __vxge_hw_device_host_info_get(hldev);