mirror of https://gitee.com/openkylin/linux.git
qlcnic: fix memory leaks
Fixes memory leak in error path when memory allocation for adapter data structures fails. Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0e995cd3d3
commit
aadd8184ae
|
@ -421,7 +421,8 @@ int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter)
|
|||
|
||||
if (addr == NULL) {
|
||||
dev_err(&pdev->dev, "failed to allocate tx desc ring\n");
|
||||
return -ENOMEM;
|
||||
err = -ENOMEM;
|
||||
goto err_out_free;
|
||||
}
|
||||
|
||||
tx_ring->desc_head = (struct cmd_desc_type0 *)addr;
|
||||
|
|
|
@ -210,7 +210,7 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter)
|
|||
cmd_buf_arr = vmalloc(TX_BUFF_RINGSIZE(tx_ring));
|
||||
if (cmd_buf_arr == NULL) {
|
||||
dev_err(&netdev->dev, "failed to allocate cmd buffer ring\n");
|
||||
return -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
memset(cmd_buf_arr, 0, TX_BUFF_RINGSIZE(tx_ring));
|
||||
tx_ring->cmd_buf_arr = cmd_buf_arr;
|
||||
|
@ -221,7 +221,7 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter)
|
|||
rds_ring = kzalloc(size, GFP_KERNEL);
|
||||
if (rds_ring == NULL) {
|
||||
dev_err(&netdev->dev, "failed to allocate rds ring struct\n");
|
||||
return -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
recv_ctx->rds_rings = rds_ring;
|
||||
|
||||
|
|
Loading…
Reference in New Issue