Bladeren bron

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
Naveen Rawat 8 jaren geleden
bovenliggende
commit
8021e459e1
1 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  1. 7 1
      core/sap/src/sap_fsm.c

+ 7 - 1
core/sap/src/sap_fsm.c

@@ -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 =