qcacld-3.0: Fix for memory leaks in multiple functions
1) Fix for memory leaks lim management frame registration queue by
unconditionally removing all nodes from queue and releasing the
node pointer. This need to be done for FTM mode also.
2) Free u_mac_post_ctrl_msgu_mac_post_ctrl_msg in the error cases.
3) In wma_tx_packet(), free tx_frame memory in error cases.
Change-Id: Idbae6b2666d38d0f130d0115e5a05387c0b63c31
CRs-fixed: 2027588
diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c
index a36fbc4..340e580 100644
--- a/core/mac/src/pe/lim/lim_api.c
+++ b/core/mac/src/pe/lim/lim_api.c
@@ -620,18 +620,16 @@
pe_deregister_mgmt_rx_frm_callback(pMac);
- if (QDF_GLOBAL_FTM_MODE != cds_get_conparam()) {
- qdf_mutex_acquire(&pMac->lim.lim_frame_register_lock);
- while (qdf_list_remove_front(
+ qdf_mutex_acquire(&pMac->lim.lim_frame_register_lock);
+ while (qdf_list_remove_front(
&pMac->lim.gLimMgmtFrameRegistratinQueue,
(qdf_list_node_t **) &pLimMgmtRegistration) ==
QDF_STATUS_SUCCESS) {
- qdf_mem_free(pLimMgmtRegistration);
- }
- qdf_mutex_release(&pMac->lim.lim_frame_register_lock);
- qdf_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
- qdf_mutex_destroy(&pMac->lim.lim_frame_register_lock);
+ qdf_mem_free(pLimMgmtRegistration);
}
+ qdf_mutex_release(&pMac->lim.lim_frame_register_lock);
+ qdf_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
+ qdf_mutex_destroy(&pMac->lim.lim_frame_register_lock);
lim_cleanup_mlm(pMac);
diff --git a/core/mac/src/pe/lim/lim_ft_preauth.c b/core/mac/src/pe/lim/lim_ft_preauth.c
index fd0cec1..071c242 100644
--- a/core/mac/src/pe/lim/lim_ft_preauth.c
+++ b/core/mac/src/pe/lim/lim_ft_preauth.c
@@ -151,10 +151,7 @@
/* Post the FT Pre Auth Response to SME */
lim_post_ft_pre_auth_rsp(mac_ctx, eSIR_FAILURE, NULL, 0,
session);
- /*
- * return FALSE, since the Pre-Auth Req will be freed in
- * limPostFTPreAuthRsp on failure
- */
+ buf_consumed = true;
return buf_consumed;
}
diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
index a3884df..dcbda5a 100644
--- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c
+++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
@@ -4157,6 +4157,7 @@
if (!local_ie_buf) {
lim_log(mac_ctx, LOGE,
FL("Mem Alloc failed for local_ie_buf"));
+ qdf_mem_free(req_buffer);
return;
}
diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
index b3dadba..c3ab05a 100644
--- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
+++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
@@ -1983,6 +1983,8 @@
PELOGE(lim_log
(pMac, LOGE, FL("Session not found for the Sta id(%d)"),
pPeStats->staId);)
+ qdf_mem_free(pPeStats->tsmStatsReq);
+ qdf_mem_free(pPeStats);
return;
}