Fix memory leak related to UCI.indication and RACH.indication

parent 48ed7fba
...@@ -254,6 +254,24 @@ static int ipc_handle_rx_msg(nv_ipc_t *ipc, nv_ipc_msg_t *msg) ...@@ -254,6 +254,24 @@ static int ipc_handle_rx_msg(nv_ipc_t *ipc, nv_ipc_msg_t *msg)
if (((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_uci_indication) { if (((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_uci_indication) {
(((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_uci_indication)(&ind); (((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_uci_indication)(&ind);
for (int i = 0; i < ind.num_ucis; i++) {
if (ind.uci_list[i].pdu_type == NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE) {
if (ind.uci_list[i].pucch_pdu_format_2_3_4.sr.sr_payload) {
free(ind.uci_list[i].pucch_pdu_format_2_3_4.sr.sr_payload);
}
if(ind.uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload){
free(ind.uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload);
}
if(ind.uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload){
free(ind.uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload);
}
if(ind.uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload){
free(ind.uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload);
}
}
}
free(ind.uci_list);
ind.uci_list = NULL;
} }
break; break;
......
...@@ -473,19 +473,19 @@ int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind) ...@@ -473,19 +473,19 @@ int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
uci_ind_pdu->sr.sr_payload = CALLOC(1, sizeof(*uci_ind_pdu->sr.sr_payload)); uci_ind_pdu->sr.sr_payload = CALLOC(1, sizeof(*uci_ind_pdu->sr.sr_payload));
AssertFatal(uci_ind_pdu->sr.sr_payload != NULL, AssertFatal(uci_ind_pdu->sr.sr_payload != NULL,
"Memory not allocated for uci_ind_pdu->sr.sr_payload in phy_nr_uci_indication."); "Memory not allocated for uci_ind_pdu->sr.sr_payload in phy_nr_uci_indication.");
*uci_ind_pdu->sr.sr_payload = *ind_pdu->sr.sr_payload; memcpy(uci_ind_pdu->sr.sr_payload,ind_pdu->sr.sr_payload,sizeof(*uci_ind_pdu->sr.sr_payload));
} }
if (ind_pdu->csi_part1.csi_part1_payload) { if (ind_pdu->csi_part1.csi_part1_payload) {
uci_ind_pdu->csi_part1.csi_part1_payload = CALLOC(1, sizeof(*uci_ind_pdu->csi_part1.csi_part1_payload)); uci_ind_pdu->csi_part1.csi_part1_payload = CALLOC(1, sizeof(*uci_ind_pdu->csi_part1.csi_part1_payload));
AssertFatal(uci_ind_pdu->csi_part1.csi_part1_payload != NULL, AssertFatal(uci_ind_pdu->csi_part1.csi_part1_payload != NULL,
"Memory not allocated for uci_ind_pdu->csi_part1.csi_part1_payload in phy_nr_uci_indication."); "Memory not allocated for uci_ind_pdu->csi_part1.csi_part1_payload in phy_nr_uci_indication.");
*uci_ind_pdu->csi_part1.csi_part1_payload = *ind_pdu->csi_part1.csi_part1_payload; memcpy(uci_ind_pdu->csi_part1.csi_part1_payload,ind_pdu->csi_part1.csi_part1_payload,sizeof(*uci_ind_pdu->csi_part1.csi_part1_payload));
} }
if (ind_pdu->csi_part2.csi_part2_payload) { if (ind_pdu->csi_part2.csi_part2_payload) {
uci_ind_pdu->csi_part2.csi_part2_payload = CALLOC(1, sizeof(*uci_ind_pdu->csi_part2.csi_part2_payload)); uci_ind_pdu->csi_part2.csi_part2_payload = CALLOC(1, sizeof(*uci_ind_pdu->csi_part2.csi_part2_payload));
AssertFatal(uci_ind_pdu->csi_part2.csi_part2_payload != NULL, AssertFatal(uci_ind_pdu->csi_part2.csi_part2_payload != NULL,
"Memory not allocated for uci_ind_pdu->csi_part2.csi_part2_payload in phy_nr_uci_indication."); "Memory not allocated for uci_ind_pdu->csi_part2.csi_part2_payload in phy_nr_uci_indication.");
*uci_ind_pdu->csi_part2.csi_part2_payload = *ind_pdu->csi_part2.csi_part2_payload; memcpy(uci_ind_pdu->csi_part2.csi_part2_payload,ind_pdu->csi_part2.csi_part2_payload,sizeof(*uci_ind_pdu->csi_part2.csi_part2_payload));
} }
break; break;
} }
......
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