Allocate gNB_DU_ID before storing ID

Update the test so it would catch that bug. Check in eq_() that both
gNB_DU_IDs would be present, or not, using xor.
This commit is contained in:
Robert Schmidt
2025-04-24 18:42:06 +02:00
parent 4da30019be
commit 413b84b179
2 changed files with 5 additions and 0 deletions
@@ -1559,6 +1559,7 @@ bool decode_f1ap_du_configuration_update(const F1AP_F1AP_PDU_t *pdu, f1ap_gnb_du
break;
case F1AP_ProtocolIE_ID_id_gNB_DU_ID:
/* gNB-DU ID (O)*/
out->gNB_DU_ID = malloc_or_fail(sizeof(*out->gNB_DU_ID));
asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, out->gNB_DU_ID);
break;
case F1AP_ProtocolIE_ID_id_GNB_DU_TNL_Association_To_Remove_List:
@@ -1586,6 +1587,8 @@ void free_f1ap_du_configuration_update(const f1ap_gnb_du_configuration_update_t
*/
bool eq_f1ap_du_configuration_update(const f1ap_gnb_du_configuration_update_t *a, const f1ap_gnb_du_configuration_update_t *b)
{
if ((a->gNB_DU_ID != NULL) ^ (b->gNB_DU_ID != NULL))
return false;
if (a->gNB_DU_ID != NULL && b->gNB_DU_ID != NULL)
_F1_EQ_CHECK_LONG(*a->gNB_DU_ID, *b->gNB_DU_ID);
_F1_EQ_CHECK_LONG(a->transaction_id, b->transaction_id);