Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
In case of an unsolicited regulatory event the memory is never freed,
so, add a check for it before allocating memory. (Cherry-picked from the
ncs/main).

Signed-off-by: Chaitanya Tata <[email protected]>
  • Loading branch information
krish2718 committed Dec 26, 2024
1 parent b3ca219 commit 9421876
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nrf70_bm_lib/source/nrf70_bm_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ static void reg_change_callbk_fn(void *vif_ctx,

fmac_dev_ctx = nrf70_bm_priv.rpu_ctx_bm.rpu_ctx;

if (!fmac_dev_ctx) {
NRF70_LOG_ERR("%s: Invalid FMAC device context", __func__);
return;
}

if (!fmac_dev_ctx->waiting_for_reg_event) {
NRF70_LOG_DBG("%s: Unsolicited regulatory change event", __func__);
/* TODO: Handle unsolicited regulatory change event */
return;
}

fmac_dev_ctx->reg_change = nrf_wifi_osal_mem_alloc(
sizeof(struct nrf_wifi_event_regulatory_change));
if (!fmac_dev_ctx->reg_change) {
Expand Down

0 comments on commit 9421876

Please sign in to comment.