From 268d409b5b823ddb59ac5998502c563d83ca8d53 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 14 Nov 2024 14:28:16 +0100 Subject: [PATCH] Prevent segfault in nr_mac_clean_cellgroup() In some runs of a multi-UE deployment, we see segfaults because cell_group->spCellConfig is NULL. We should not segfault in that case, so check for spCellConfig. --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index dc442bedd0..7e66a0e2ac 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2962,8 +2962,9 @@ void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slo static void nr_mac_clean_cellgroup(NR_CellGroupConfig_t *cell_group) { + DevAssert(cell_group != NULL); /* remove a reconfigurationWithSync, we don't need it anymore */ - if (cell_group->spCellConfig->reconfigurationWithSync != NULL) { + if (cell_group->spCellConfig && cell_group->spCellConfig->reconfigurationWithSync != NULL) { ASN_STRUCT_FREE(asn_DEF_NR_ReconfigurationWithSync, cell_group->spCellConfig->reconfigurationWithSync); cell_group->spCellConfig->reconfigurationWithSync = NULL; }