qcacld-3.0: Fix memleak in scan for ssid if scan req allocation fails

In scan for ssid if scan req allocation fails in csr_scan_for_ssid,
status is success and thus the memories are not freed for
scan_info.profile results in memleak.

Fix is to free mem for scan_info.profile in case if scan req allocation
fails in csr_scan_for_ssid.

Change-Id: I45ac2093bdd6d2d17b353f805a157dcea80a2623
CRs-Fixed: 2372803
This commit is contained in:
Abhinav Kumar 2018-12-26 15:18:11 +05:30 committed by nshrivas
parent f6ff31b081
commit 3b724f5fa9

View File

@ -1410,15 +1410,17 @@ QDF_STATUS csr_scan_for_ssid(struct mac_context *mac_ctx, uint32_t session_id,
status = csr_roam_copy_profile(mac_ctx,
session->scan_info.profile,
profile);
if (!QDF_IS_STATUS_SUCCESS(status))
if (QDF_IS_STATUS_ERROR(status))
goto error;
scan_id = ucfg_scan_get_scan_id(mac_ctx->psoc);
session->scan_info.scan_id = scan_id;
session->scan_info.scan_reason = eCsrScanForSsid;
session->scan_info.roam_id = roam_id;
req = qdf_mem_malloc(sizeof(*req));
if (!req)
if (!req) {
status = QDF_STATUS_E_NOMEM;
goto error;
}
vdev = wlan_objmgr_get_vdev_by_macaddr_from_psoc(mac_ctx->psoc,
pdev_id,
@ -1494,7 +1496,7 @@ QDF_STATUS csr_scan_for_ssid(struct mac_context *mac_ctx, uint32_t session_id,
status = ucfg_scan_start(req);
wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID);
error:
if (!QDF_IS_STATUS_SUCCESS(status)) {
if (QDF_IS_STATUS_ERROR(status)) {
sme_err("failed to initiate scan with status: %d", status);
csr_release_profile(mac_ctx, session->scan_info.profile);
qdf_mem_free(session->scan_info.profile);