wlan: Fix memory leak in WDA_WniCfgDnld()
Static source code analysis identified an error path in
WDA_WniCfgDnld() which could leak memory. Update the code so that the
allocated config file buffer is always freed.
Change-Id: I186250d2a7f00f389e75bdc9e791ead065996502
CRs-fixed: 470188
diff --git a/CORE/WDA/src/wlan_qct_wda.c b/CORE/WDA/src/wlan_qct_wda.c
index 9de3e9d..d3fa64f 100644
--- a/CORE/WDA/src/wlan_qct_wda.c
+++ b/CORE/WDA/src/wlan_qct_wda.c
@@ -1868,8 +1868,8 @@
v_SIZE_t cbFileImageSize = 0;
v_VOID_t *pCfgBinary = NULL;
v_SIZE_t cbCfgBinarySize = 0;
-
v_BOOL_t bStatus = VOS_FALSE;
+
if (NULL == pMac )
{
VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -1926,16 +1926,12 @@
* for now calling the existing cfg download API
*/
processCfgDownloadReq(pMac,cbCfgBinarySize,pCfgBinary);
- if( pFileImage != NULL )
- {
- vos_mem_free( pFileImage );
- }
- return vosStatus;
+ vosStatus = VOS_STATUS_SUCCESS;
+
+ /* fall through to clean up and return success */
fail:
- if(pCfgBinary != NULL)
- vos_mem_free( pFileImage );
-
+ vos_mem_free( pFileImage );
return vosStatus;
}
/* -----------------------------------------------------------------