diff options
| -rw-r--r-- | CORE/SERVICES/WMA/wma.c | 1 | ||||
| -rw-r--r-- | CORE/SME/src/sme_common/sme_Api.c | 13 |
2 files changed, 5 insertions, 9 deletions
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index 602a2985d521..a99d70c29039 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -29093,7 +29093,6 @@ static VOS_STATUS wma_set_bpf_instructions(tp_wma_handle wma, buf_ptr += WMI_TLV_HDR_SIZE; vos_mem_copy(buf_ptr, bpf_set_offload->program, bpf_set_offload->current_length); - vos_mem_free(bpf_set_offload->program); } if (wmi_unified_cmd_send(wma->wmi_handle, wmi_buf, len, diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c index 1746c414e01d..11b67d51d17f 100644 --- a/CORE/SME/src/sme_common/sme_Api.c +++ b/CORE/SME/src/sme_common/sme_Api.c @@ -18238,14 +18238,15 @@ eHalStatus sme_set_bpf_instructions(tHalHandle hal, vos_msg_t vos_msg; struct sir_bpf_set_offload *set_offload; - set_offload = vos_mem_malloc(sizeof(*set_offload)); + set_offload = vos_mem_malloc(sizeof(*set_offload) + + req->current_length); if (NULL == set_offload) { VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("Failed to alloc set_offload")); return eHAL_STATUS_FAILED_ALLOC; } - vos_mem_zero(set_offload, sizeof(*set_offload)); + vos_mem_zero(set_offload, sizeof(*set_offload) + req->current_length); set_offload->session_id = req->session_id; set_offload->filter_id = req->filter_id; @@ -18253,8 +18254,8 @@ eHalStatus sme_set_bpf_instructions(tHalHandle hal, set_offload->total_length = req->total_length; set_offload->current_length = req->current_length; if (set_offload->total_length) { - set_offload->program = vos_mem_malloc(sizeof(uint8_t) * - req->current_length); + set_offload->program = ((uint8_t *)set_offload) + + sizeof(*set_offload); vos_mem_copy(set_offload->program, req->program, set_offload->current_length); } @@ -18269,16 +18270,12 @@ eHalStatus sme_set_bpf_instructions(tHalHandle hal, VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("Post BPF set offload msg fail")); status = eHAL_STATUS_FAILURE; - if (set_offload->total_length) - vos_mem_free(set_offload->program); vos_mem_free(set_offload); } sme_ReleaseGlobalLock(&mac_ctx->sme); } else { VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("sme_AcquireGlobalLock failed")); - if (set_offload->total_length) - vos_mem_free(set_offload->program); vos_mem_free(set_offload); } return status; |
