qcacld-3.0: Fix psoc ref and memory leaks in mac_open

psoc ref count and mac_context memory is leaked in failure cases
of mac_open API.

Fix the psoc ref count and memory leaks in failure cases.

Change-Id: I39eaa7bef5e5c50b9b1a8833bec5e6da8cdf0d72
CRs-Fixed: 2302187
This commit is contained in:
Vignesh Viswanathan
2018-08-28 10:13:48 +05:30
committed by nshrivas
parent 9658cff303
commit 6b89ab57b5

View File

@@ -144,7 +144,8 @@ QDF_STATUS mac_open(struct wlan_objmgr_psoc *psoc, tHalHandle *pHalHandle,
mlme_obj = mlme_get_psoc_obj(psoc); mlme_obj = mlme_get_psoc_obj(psoc);
if (!mlme_obj) { if (!mlme_obj) {
pe_err("Failed to get MLME Obj"); pe_err("Failed to get MLME Obj");
return QDF_STATUS_E_FAILURE; status = QDF_STATUS_E_FAILURE;
goto fail;
} }
p_mac->mlme_cfg = &mlme_obj->cfg; p_mac->mlme_cfg = &mlme_obj->cfg;
@@ -159,8 +160,8 @@ QDF_STATUS mac_open(struct wlan_objmgr_psoc *psoc, tHalHandle *pHalHandle,
/* Call routine to initialize CFG data structures */ /* Call routine to initialize CFG data structures */
if (QDF_STATUS_SUCCESS != cfg_init(p_mac)) { if (QDF_STATUS_SUCCESS != cfg_init(p_mac)) {
mac_free_context_buffer(); status = QDF_STATUS_E_FAILURE;
return QDF_STATUS_E_FAILURE; goto fail;
} }
sys_init_globals(p_mac); sys_init_globals(p_mac);
@@ -174,10 +175,14 @@ QDF_STATUS mac_open(struct wlan_objmgr_psoc *psoc, tHalHandle *pHalHandle,
status = pe_open(p_mac, cds_cfg); status = pe_open(p_mac, cds_cfg);
if (QDF_STATUS_SUCCESS != status) { if (QDF_STATUS_SUCCESS != status) {
pe_err("pe_open() failure"); pe_err("pe_open() failure");
mac_free_context_buffer();
cfg_de_init(p_mac); cfg_de_init(p_mac);
goto fail;
} }
return status;
fail:
wlan_objmgr_psoc_release_ref(psoc, WLAN_LEGACY_MAC_ID);
mac_free_context_buffer();
return status; return status;
} }