summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortinlin <tinlin@codeaurora.org>2018-06-28 19:52:50 +0800
committertinlin <tinlin@codeaurora.org>2018-06-28 19:57:35 +0800
commite736b038dfb1d53dd52d2dbdbde43b1c4a71c591 (patch)
tree22005c1b3563a31be93eb9cbdea53ed3dc7368cd
parent8f7f354ff0f53e8bbff3ceb4918edd29847d3eb6 (diff)
qcacld-2.0: Fix memory leak in wlan_hdd_set_powersave
In Ia454f5ef59f1e687627ce7275a31f877ce49b4b1, Memory leak may happen when DUT enters DRIVER_POWER_MODE_AUTO mode. Malloc "request" in DRIVER_POWER_MODE_ACTIVE mode. Change-Id: I1d6b8de8ac639a4c38abb7e95f7fc802b41b7400 CRs-Fixed: 2270063
-rw-r--r--CORE/HDD/src/wlan_hdd_wext.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index a85ab2996f33..4e4cd55f985a 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -4092,12 +4092,6 @@ VOS_STATUS wlan_hdd_set_powersave(hdd_adapter_t *pAdapter, int mode)
{
hdd_context_t *pHddCtx;
eHalStatus status;
- void *cookie;
- struct hdd_request *request;
- static const struct hdd_request_params params = {
- .priv_size = 0,
- .timeout_ms = WLAN_WAIT_TIME_POWER,
- };
if (NULL == pAdapter)
{
@@ -4105,20 +4099,27 @@ VOS_STATUS wlan_hdd_set_powersave(hdd_adapter_t *pAdapter, int mode)
return VOS_STATUS_E_FAULT;
}
- request = hdd_request_alloc(&params);
- if (!request) {
- hddLog(VOS_TRACE_LEVEL_ERROR,
- "%s: Request allocation failure", __func__);
- return VOS_STATUS_E_NOMEM;
- }
- cookie = hdd_request_cookie(request);
-
hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "power mode=%d", mode);
pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
if (DRIVER_POWER_MODE_ACTIVE == mode)
{
+ void *cookie;
+ struct hdd_request *request;
+ static const struct hdd_request_params params = {
+ .priv_size = 0,
+ .timeout_ms = WLAN_WAIT_TIME_POWER,
+ };
+
+ request = hdd_request_alloc(&params);
+ if (!request) {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ "%s: Request allocation failure", __func__);
+ return VOS_STATUS_E_NOMEM;
+ }
+ cookie = hdd_request_cookie(request);
+
hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering "
"Full Power", __func__);