fix the bug for memory leak of handover message(enb/mme status trasfer) encoding/decoding
This commit is contained in:
parent
0b6657f501
commit
f783e2ffd0
|
@ -932,6 +932,7 @@ status_t s1ap_build_mme_status_transfer(pkbuf_t **s1apbuf,
|
||||||
enb_ue_t *enb_ue, S1ap_ENBStatusTransferIEs_t *enb_ies)
|
enb_ue_t *enb_ue, S1ap_ENBStatusTransferIEs_t *enb_ies)
|
||||||
{
|
{
|
||||||
char buf[INET_ADDRSTRLEN];
|
char buf[INET_ADDRSTRLEN];
|
||||||
|
int i;
|
||||||
|
|
||||||
int encoded;
|
int encoded;
|
||||||
s1ap_message_t message;
|
s1ap_message_t message;
|
||||||
|
@ -944,9 +945,24 @@ status_t s1ap_build_mme_status_transfer(pkbuf_t **s1apbuf,
|
||||||
|
|
||||||
mme_ies->mme_ue_s1ap_id = enb_ue->mme_ue_s1ap_id;
|
mme_ies->mme_ue_s1ap_id = enb_ue->mme_ue_s1ap_id;
|
||||||
mme_ies->eNB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id;
|
mme_ies->eNB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id;
|
||||||
memcpy(&mme_ies->eNB_StatusTransfer_TransparentContainer,
|
|
||||||
&enb_ies->eNB_StatusTransfer_TransparentContainer,
|
for (i = 0; i < enb_ies->eNB_StatusTransfer_TransparentContainer.
|
||||||
sizeof(S1ap_ENB_StatusTransfer_TransparentContainer_t));
|
bearers_SubjectToStatusTransferList.list.count; i++)
|
||||||
|
{
|
||||||
|
S1ap_IE_t *enb_ie = NULL, *mme_ie = NULL;
|
||||||
|
|
||||||
|
enb_ie = (S1ap_IE_t *)enb_ies->
|
||||||
|
eNB_StatusTransfer_TransparentContainer.
|
||||||
|
bearers_SubjectToStatusTransferList.list.array[i];
|
||||||
|
d_assert(enb_ie, return CORE_ERROR, "Null param");
|
||||||
|
|
||||||
|
mme_ie = s1ap_copy_ie(enb_ie);
|
||||||
|
d_assert(mme_ie, return CORE_ERROR, "Null param");
|
||||||
|
|
||||||
|
ASN_SEQUENCE_ADD(&mme_ies->
|
||||||
|
eNB_StatusTransfer_TransparentContainer.
|
||||||
|
bearers_SubjectToStatusTransferList, mme_ie);
|
||||||
|
}
|
||||||
|
|
||||||
message.procedureCode = S1ap_ProcedureCode_id_MMEStatusTransfer;
|
message.procedureCode = S1ap_ProcedureCode_id_MMEStatusTransfer;
|
||||||
message.direction = S1AP_PDU_PR_initiatingMessage;
|
message.direction = S1AP_PDU_PR_initiatingMessage;
|
||||||
|
|
|
@ -108,3 +108,20 @@ void s1ap_ENB_ID_to_uint32(S1ap_ENB_ID_t *eNB_ID, c_uint32_t *uint32)
|
||||||
d_assert(0, return, "Invalid param");
|
d_assert(0, return, "Invalid param");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
S1ap_IE_t *s1ap_copy_ie(S1ap_IE_t *ie)
|
||||||
|
{
|
||||||
|
S1ap_IE_t *buff;
|
||||||
|
|
||||||
|
buff = core_malloc(sizeof (S1ap_IE_t));
|
||||||
|
d_assert(buff, return NULL,);
|
||||||
|
|
||||||
|
memset((void *)buff, 0, sizeof(S1ap_IE_t));
|
||||||
|
buff->id = ie->id;
|
||||||
|
buff->criticality = ie->criticality;
|
||||||
|
buff->value.size = ie->value.size;
|
||||||
|
buff->value.buf = core_calloc(1, buff->value.size);
|
||||||
|
memcpy(buff->value.buf, ie->value.buf, buff->value.size);
|
||||||
|
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ CORE_DECLARE(void) s1ap_uint32_to_ENB_ID(
|
||||||
CORE_DECLARE(void) s1ap_ENB_ID_to_uint32(
|
CORE_DECLARE(void) s1ap_ENB_ID_to_uint32(
|
||||||
S1ap_ENB_ID_t *eNB_ID, c_uint32_t *uint32);
|
S1ap_ENB_ID_t *eNB_ID, c_uint32_t *uint32);
|
||||||
|
|
||||||
|
CORE_DECLARE(S1ap_IE_t *) s1ap_copy_ie(S1ap_IE_t *ie);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
|
@ -614,7 +614,6 @@ static void handover_test2(abts_case *tc, void *data)
|
||||||
|
|
||||||
core_sleep(time_from_msec(300));
|
core_sleep(time_from_msec(300));
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Send Handover Required */
|
/* Send Handover Required */
|
||||||
rv = tests1ap_build_handover_required(&sendbuf, 1);
|
rv = tests1ap_build_handover_required(&sendbuf, 1);
|
||||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||||
|
@ -670,7 +669,6 @@ static void handover_test2(abts_case *tc, void *data)
|
||||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||||
|
|
||||||
core_sleep(time_from_msec(300));
|
core_sleep(time_from_msec(300));
|
||||||
#endif
|
|
||||||
|
|
||||||
/********** Remove Subscriber in Database */
|
/********** Remove Subscriber in Database */
|
||||||
doc = BCON_NEW("imsi", BCON_UTF8("001010123456815"));
|
doc = BCON_NEW("imsi", BCON_UTF8("001010123456815"));
|
||||||
|
|
Loading…
Reference in New Issue