Fix memory leak related to RX_DATA.indication message

parent 8a8b38ae
......@@ -222,6 +222,10 @@ static int ipc_handle_rx_msg(nv_ipc_t *ipc, nv_ipc_msg_t *msg)
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RX Indication\n", __FUNCTION__);
if (((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_rx_data_indication) {
(((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_rx_data_indication)(&ind);
for (int i = 0; i < ind.number_of_pdus; ++i) {
free(ind.pdu_list[i].pdu);
}
free(ind.pdu_list);
}
break;
}
......
......@@ -358,7 +358,8 @@ int aerial_phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind)
rx_ind->pdu_list[j].ul_cqi = ind->pdu_list[j].ul_cqi;
rx_ind->pdu_list[j].timing_advance = ind->pdu_list[j].timing_advance;
rx_ind->pdu_list[j].rssi = ind->pdu_list[j].rssi;
rx_ind->pdu_list[j].pdu = ind->pdu_list[j].pdu;
rx_ind->pdu_list[j].pdu = calloc(rx_ind->pdu_list[j].pdu_length, sizeof(uint8_t));
memcpy(rx_ind->pdu_list[j].pdu,ind->pdu_list[j].pdu,ind->pdu_list[j].pdu_length);
LOG_D(NR_MAC,
"(%d.%d) Handle %d for index %d, RNTI, %04x, HARQID %d\n",
ind->sfn,
......@@ -920,8 +921,7 @@ static uint8_t aerial_unpack_nr_rx_data_indication_body(nfapi_nr_rx_data_pdu_t *
}
// Allocate space for the pdu to be unpacked later
uint32_t length = value->pdu_length;
value->pdu = nfapi_p7_allocate(sizeof(*value->pdu) * length, config);
value->pdu = nfapi_p7_allocate(sizeof(*value->pdu) * value->pdu_length, config);
return 1;
}
......
......@@ -267,6 +267,9 @@ static void free_unqueued_nfapi_indications(nfapi_nr_rach_indication_t *rach_ind
}
if (rx_ind && rx_ind->number_of_pdus > 0)
{
for (int i = 0; i < rx_ind->number_of_pdus; ++i) {
free_and_zero(rx_ind->pdu_list[i].pdu);
}
free_and_zero(rx_ind->pdu_list);
free_and_zero(rx_ind);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment