summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKapil Gupta <kapgupta@codeaurora.org>2016-09-27 13:02:07 +0530
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-09-30 12:12:31 +0530
commit607d44531bc9fcdf4920ca7fe994e082c286d0e0 (patch)
treee652519ee6b20a996d5117421983fe9aaf4dcc99
parent52a15244b6e73116ea01a7ae0a1f2f796b36706c (diff)
qcacld-2.0: Fix memory leak issue
Memory should be allocated to radar_event only when radar phy event needs to be sent to WMA layer. Add changes to fix memory leak. CRs-Fixed: 1065466 Change-Id: Ia3e93ddd47913956c27487472b6a70eb68d63fd9
-rw-r--r--CORE/SERVICES/WMA/wma.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c
index 64fe2f79693e..8083baf6622d 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -36591,20 +36591,12 @@ int wma_dfs_indicate_radar(struct ieee80211com *ic,
WMA_LOGE("%s:DFS- Invalid WMA handle", __func__);
return -ENOENT;
}
- radar_event = (struct wma_dfs_radar_indication *)
- vos_mem_malloc(sizeof(struct wma_dfs_radar_indication));
- if (radar_event == NULL)
- {
- WMA_LOGE("%s:DFS- Invalid radar_event", __func__);
- return -ENOENT;
- }
/*
* Do not post multiple Radar events on the same channel.
* But, when DFS test mode is enabled, allow multiple dfs
* radar events to be posted on the same channel.
*/
-
adf_os_spin_lock_bh(&ic->chan_lock);
if (!pmac->sap.SapDfsInfo.disable_dfs_ch_switch)
wma->dfs_ic->disable_phy_err_processing = true;
@@ -36612,6 +36604,13 @@ int wma_dfs_indicate_radar(struct ieee80211com *ic,
if ((ichan->ic_ieee != (wma->dfs_ic->last_radar_found_chan)) ||
( pmac->sap.SapDfsInfo.disable_dfs_ch_switch == VOS_TRUE) )
{
+ radar_event = (struct wma_dfs_radar_indication *)
+ vos_mem_malloc(sizeof(*radar_event));
+ if (radar_event == NULL) {
+ WMA_LOGE(FL("Failed to allocate memory for radar_event"));
+ return -ENOMEM;
+ }
+
/* Indicate the radar event to HDD to stop the netif Tx queues*/
hdd_radar_event.ieee_chan_number = ichan->ic_ieee;
hdd_radar_event.chan_freq = ichan->ic_freq;