Skip to content

Commit

Permalink
cxgb4: fix memory leak on txq_info
Browse files Browse the repository at this point in the history
Currently if txq_info->uldtxq cannot be allocated then
txq_info->txq is being kfree'd (which is redundant because it
is NULL) instead of txq_info. Fix this by instead kfree'ing
txq_info.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Colin Ian King authored and davem330 committed Nov 25, 2016
1 parent 436acce commit 619228d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ setup_sge_txq_uld(struct adapter *adap, unsigned int uld_type,
txq_info->uldtxq = kcalloc(txq_info->ntxq, sizeof(struct sge_uld_txq),
GFP_KERNEL);
if (!txq_info->uldtxq) {
kfree(txq_info->uldtxq);
kfree(txq_info);
return -ENOMEM;
}

Expand Down

0 comments on commit 619228d

Please sign in to comment.