Skip to content

Commit 202fd11

Browse files
committed
Fix memory leak
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]>
1 parent 2f28fe0 commit 202fd11

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

nrf70_bm_lib/source/nrf70_bm_core.c

+11
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,17 @@ static void reg_change_callbk_fn(void *vif_ctx,
114114

115115
fmac_dev_ctx = nrf70_bm_priv.rpu_ctx_bm.rpu_ctx;
116116

117+
if (!fmac_dev_ctx) {
118+
NRF70_LOG_ERR("%s: Invalid FMAC device context", __func__);
119+
return;
120+
}
121+
122+
if (!fmac_dev_ctx->waiting_for_reg_event) {
123+
NRF70_LOG_DBG("%s: Unsolicited regulatory change event", __func__);
124+
/* TODO: Handle unsolicited regulatory change event */
125+
return;
126+
}
127+
117128
fmac_dev_ctx->reg_change = nrf_wifi_osal_mem_alloc(
118129
sizeof(struct nrf_wifi_event_regulatory_change));
119130
if (!fmac_dev_ctx->reg_change) {

0 commit comments

Comments
 (0)