Skip to content

Commit

Permalink
netxen: fix memory leaks in error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Amit Kumar Salecha authored and David S. Miller committed Jun 16, 2010
1 parent 44b496f commit bf44508
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion drivers/net/netxen/netxen_nic_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/netxen/netxen_nic_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit bf44508

Please sign in to comment.