ath10k: fix memory leak of tpc_stats
authorColin Ian King <colin.king@canonical.com>
Sun, 27 May 2018 21:17:02 +0000 (22:17 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 13 Jun 2018 11:50:40 +0000 (14:50 +0300)
commit260e629bbf441585860e21d5e10d2e88437f47c8
tree179e22bf6faf500235ba2fc8e60a566750d4904a
parent12b67b0d6bcbe91d8b0682610f43d1cd8cdf280e
ath10k: fix memory leak of tpc_stats

Currently tpc_stats is allocated and is leaked on the return
path if num_tx_chain is greater than WMI_TPC_TX_N_CHAIN. Avoid
this leak by performing the check on num_tx_chain before the
allocation of tpc_stats.

Detected by CoverityScan, CID#1469422 ("Resource Leak")
Fixes: 4b190675ad06 ("ath10k: fix kernel panic while reading tpc_stats")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath10k/wmi.c