Kaynağa Gözat

qcacld-3.0: Free roam_info in sme_rrm_send_scan_result

Free roam_info in sme_rrm_send_scan_result for all error cases to
avoid memory leak.

Change-Id: I9a30c0c5e349d926092a881c4e2720100836e9d1
CRs-Fixed: 2344465
Tushnim Bhattacharyya 6 yıl önce
ebeveyn
işleme
4a0de7ac35
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 2 2
      core/sme/src/rrm/sme_rrm.c

+ 2 - 2
core/sme/src/rrm/sme_rrm.c

@@ -421,7 +421,7 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx,
 	uint8_t num_scan_results, counter = 0;
 	tpRrmSMEContext rrm_ctx = &mac_ctx->rrm.rrmSmeContext;
 	uint32_t session_id;
-	struct csr_roam_info *roam_info;
+	struct csr_roam_info *roam_info = NULL;
 	tSirScanType scan_type;
 	struct csr_roam_session *session;
 
@@ -578,7 +578,6 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx,
 		if (counter >= num_scan_results)
 			break;
 	}
-	qdf_mem_free(roam_info);
 	/*
 	 * The beacon report should be sent whether the counter is zero or
 	 * non-zero. There might be a few scan results in the cache but not
@@ -607,6 +606,7 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx,
 rrm_send_scan_results_done:
 	if (scanresults_arr)
 		qdf_mem_free(scanresults_arr);
+	qdf_mem_free(roam_info);
 	sme_scan_result_purge(result_handle);
 
 	return status;