diff --git a/core/sme/src/csr/csr_neighbor_roam.c b/core/sme/src/csr/csr_neighbor_roam.c index b6b41fb8b562..8eacf1063ea7 100644 --- a/core/sme/src/csr/csr_neighbor_roam.c +++ b/core/sme/src/csr/csr_neighbor_roam.c @@ -384,8 +384,11 @@ csr_neighbor_roam_prepare_scan_profile_filter(struct mac_context *mac, pScanFilter->SSIDs.SSIDList = qdf_mem_malloc(sizeof(tCsrSSIDInfo) * pScanFilter->SSIDs.numOfSSIDs); - if (!pScanFilter->SSIDs.SSIDList) + if (!pScanFilter->SSIDs.SSIDList) { + qdf_mem_free(pScanFilter->BSSIDs.bssid); + pScanFilter->BSSIDs.bssid = NULL; return QDF_STATUS_E_NOMEM; + } for (i = 0; i < roam_params->num_ssid_allowed_list; i++) { pScanFilter->SSIDs.SSIDList[i].handoffPermitted = 1; @@ -402,8 +405,11 @@ csr_neighbor_roam_prepare_scan_profile_filter(struct mac_context *mac, pScanFilter->SSIDs.numOfSSIDs = 1; pScanFilter->SSIDs.SSIDList = qdf_mem_malloc(sizeof(tCsrSSIDInfo)); - if (!pScanFilter->SSIDs.SSIDList) + if (!pScanFilter->SSIDs.SSIDList) { + qdf_mem_free(pScanFilter->BSSIDs.bssid); + pScanFilter->BSSIDs.bssid = NULL; return QDF_STATUS_E_NOMEM; + } pScanFilter->SSIDs.SSIDList->handoffPermitted = 1; pScanFilter->SSIDs.SSIDList->ssidHidden = 0; @@ -442,6 +448,8 @@ csr_neighbor_roam_prepare_scan_profile_filter(struct mac_context *mac, pScanFilter->ChannelInfo.ChannelList = qdf_mem_malloc(num_ch * sizeof(uint8_t)); if (!pScanFilter->ChannelInfo.ChannelList) { + qdf_mem_free(pScanFilter->BSSIDs.bssid); + pScanFilter->BSSIDs.bssid = NULL; qdf_mem_free(pScanFilter->SSIDs.SSIDList); pScanFilter->SSIDs.SSIDList = NULL; return QDF_STATUS_E_NOMEM;