From f248b2fdff1eccc703676accbc1f548751fd00ed Mon Sep 17 00:00:00 2001 From: sriharsha Date: Tue, 10 Oct 2023 17:21:55 +0200 Subject: [PATCH] fix: avoid freeing rlc config structure --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 2 +- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 6 +++--- openair2/RRC/NR/MESSAGES/asn1_msg.c | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 612eb03271..a5bedece5f 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -649,7 +649,7 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id, } // reorder the logical channels as per its priority - qsort_r((void *)mac->lc_ordered_info.lcids_ordered, rlc_toadd_list->list.count, sizeof(uint32_t), lcid_cmp, (void *)mac); + qsort_r(mac->lc_ordered_info.lcids_ordered, rlc_toadd_list->list.count, sizeof(uint32_t), lcid_cmp, mac); for (uint8_t i = 0; i < rlc_toadd_list->list.count; i++) { mac->lc_ordered_info.logicalChannelConfig_ordered[i] = mac->logicalChannelConfig[mac->lc_ordered_info.lcids_ordered[i] - 1]; } diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 77c6fd6c8d..5ec205adaf 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -106,7 +106,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) { nr_rrc_mac_config_req_ue_logicalChannelBearer(0, &rlc_toadd_list, NULL); // free memory - free_nr_noS1_bearer_config(&rbconfig, &rlc_rbconfig); + free_nr_noS1_bearer_config(&rbconfig, NULL); } } else { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 5f7728eb3a..fc26b1e860 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -3072,9 +3072,9 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP, for (uint8_t id = 0; id < avail_lcids_count; id++) { /* - loop over all logical channels in the order of priority. As stated in ts spec, in the first run, only prioritized - number of bytes are taken out from the correspondinf RLC buffers of all active logical channels and if there is still - space availble in the MAC PDU, then from the next run all the remaining data from the higher priority logical channel + loop over all logical channels in the order of priority. As stated in TS138.321 Section 5.4.3.1, in the first run, only + prioritized number of bytes are taken out from the corresponding RLC buffers of all active logical channels and if there is + still space availble in the MAC PDU, then from the next run all the remaining data from the higher priority logical channel is placed in the MAC PDU before going on to next high priority logical channel */ int lcid = lcids_bj_pos[id]; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index c6115c555d..f5e060e251 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -460,8 +460,10 @@ void free_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, { ASN_STRUCT_FREE(asn_DEF_NR_RadioBearerConfig, *rbconfig); *rbconfig = NULL; - ASN_STRUCT_FREE(asn_DEF_NR_RLC_BearerConfig, *rlc_rbconfig); - *rlc_rbconfig = NULL; + if (rlc_rbconfig != NULL) { + ASN_STRUCT_FREE(asn_DEF_NR_RLC_BearerConfig, *rlc_rbconfig); + *rlc_rbconfig = NULL; + } } //------------------------------------------------------------------------------