diff options
author | Amit Kumar Salecha <amit.salecha@qlogic.com> | 2010-06-13 23:39:03 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-15 18:15:26 -0700 |
commit | bf445080dad9542c6bc6b693d941cae89605134c (patch) | |
tree | 973dc69dee286bc97aa7f927481b3359e265c7bb /drivers/net/netxen | |
parent | 44b496f685ca68c0d96eb3ad88e3948fad3417d6 (diff) | |
download | op-kernel-dev-bf445080dad9542c6bc6b693d941cae89605134c.zip op-kernel-dev-bf445080dad9542c6bc6b693d941cae89605134c.tar.gz |
netxen: fix memory leaks in error path
Fixes memory leak in error path when memory allocation
for adapter data structures fails.
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r-- | drivers/net/netxen/netxen_nic_ctx.c | 3 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c index f26e547..3a41b6a 100644 --- a/drivers/net/netxen/netxen_nic_ctx.c +++ b/drivers/net/netxen/netxen_nic_ctx.c @@ -629,7 +629,8 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter) if (addr == NULL) { dev_err(&pdev->dev, "%s: failed to allocate tx desc ring\n", netdev->name); - return -ENOMEM; + err = -ENOMEM; + goto err_out_free; } tx_ring->desc_head = (struct cmd_desc_type0 *)addr; diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 045a7c8..e08527f 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c @@ -218,7 +218,7 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter) if (cmd_buf_arr == NULL) { dev_err(&pdev->dev, "%s: failed to allocate cmd buffer ring\n", netdev->name); - return -ENOMEM; + goto err_out; } memset(cmd_buf_arr, 0, TX_BUFF_RINGSIZE(tx_ring)); tx_ring->cmd_buf_arr = cmd_buf_arr; @@ -230,7 +230,7 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter) if (rds_ring == NULL) { dev_err(&pdev->dev, "%s: failed to allocate rds ring struct\n", netdev->name); - return -ENOMEM; + goto err_out; } recv_ctx->rds_rings = rds_ring; |