diff options
| author | Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com> | 2014-02-19 17:43:45 +0530 |
|---|---|---|
| committer | Akash Patel <c_akashp@qca.qualcomm.com> | 2014-02-21 17:36:09 -0800 |
| commit | 03bd5ad0ace3d3e8a3efc4a46e854e4038ae565f (patch) | |
| tree | 53bc1c5fca177621f358cd6857346287c7cbd441 | |
| parent | 87a632a54e05e49b33c581d81409137be7ff5b54 (diff) | |
qcacld: Fix kmemleak warnings
Fix possible memory leak in the memory allocated
for power save configuration for device which does
not have power save offloaded. Move the allocation
under !psOffloadEnable check to make sure the memory
is not allocated only when it is needed.
Change-Id: Idd7a3ca063c255755ef82dbeba333aa42874f53b
CRs-Fixed: 607843
| -rw-r--r-- | CORE/MAC/src/pe/lim/limApi.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/CORE/MAC/src/pe/lim/limApi.c b/CORE/MAC/src/pe/lim/limApi.c index 785fe1c61bef..c64b1ed57dbc 100644 --- a/CORE/MAC/src/pe/lim/limApi.c +++ b/CORE/MAC/src/pe/lim/limApi.c @@ -580,31 +580,31 @@ static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac ) /* WNI_CFG_MAX_PS_POLL */ - /* Allocate and fill in power save configuration. */ - pPowerSaveConfig = vos_mem_malloc(sizeof(tSirPowerSaveCfg)); - if (NULL == pPowerSaveConfig) - { - PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save " - "configuration"));) - return eSIR_FAILURE; - } - - /* This context should be valid if power-save configuration message has been - * already dispatched during initialization process. Re-using the present - * configuration mask - */ if (!pMac->psOffloadEnabled) { - vos_mem_copy(pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, + /* Allocate and fill in power save configuration. */ + pPowerSaveConfig = vos_mem_malloc(sizeof(tSirPowerSaveCfg)); + if (NULL == pPowerSaveConfig) + { + PELOGE(limLog(pMac, LOGE, + FL("LIM: Cannot allocate memory for power save configuration"));) + return eSIR_FAILURE; + } + + /* This context should be valid if power-save configuration message has + * been already dispatched during initialization process. Re-using the + * present configuration mask + */ + vos_mem_copy(pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg)); - /* Note: it is okay to do this since DAL/HAL is alrady started */ - if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS) - { - PELOGE(limLog(pMac, LOGE, + /* Note: it is okay to do this since DAL/HAL is alrady started */ + if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS) + { + PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed "));) - return eSIR_FAILURE; - } + return eSIR_FAILURE; + } } /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */ |
