summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKapil Gupta <kapgupta@codeaurora.org>2016-09-27 13:02:07 +0530
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-10-04 19:19:11 +0530
commit8f72c5dab7cd274655a93da86358fa7a8047917a (patch)
tree35bf5bfc0034304939dc3346e48fcbe61e51d9f8
parentce5af24c2e33f02594b8201cd9dbb52617503acb (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 bb5fccaa4567..db6f8faccde1 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -36459,20 +36459,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;
@@ -36480,6 +36472,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;