qcacld-3.0: Fix memory leak in restart bss path

Function sapconvert_to_csr_profile is allocating memory for
pRSNReqIE without checking if it is already populated. This
will leak memory if this function is getting called for sap
restart. Fix this by first freeing memory if already allocated.

Change-Id: I562b1dabb330057b4f1b934b0edad692330aab70
CRs-Fixed: 2046608
This commit is contained in:
Naveen Rawat 2017-05-12 13:47:17 -07:00 • committed by snandini
commit 8021e459e1

View file

@ -3649,8 +3649,14 @@ sapconvert_to_csr_profile(tsap_Config_t *pconfig_params, eCsrRoamBssType bssType
profile->pWPAReqIE = NULL;
profile->nWPAReqIELength = 0;
if (profile->pRSNReqIE) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG,
FL("pRSNReqIE already allocated."));
qdf_mem_free(profile->pRSNReqIE);
profile->pRSNReqIE = NULL;
}
/* set the RSN/WPA IE */
profile->pRSNReqIE = NULL;
profile->nRSNReqIELength = pconfig_params->RSNWPAReqIELength;
if (pconfig_params->RSNWPAReqIELength) {
profile->pRSNReqIE =