Commit ab4a1806 authored by masayuki.harada's avatar masayuki.harada Committed by Haruki NAOI

Fix: Memory leak.

(cherry picked from commit 7013d216db25347d89d6152f37aea5333f72c372)
parent f5433cb0
......@@ -647,6 +647,7 @@ rlc_op_status_t rrc_rlc_remove_rlc (
rb_idP, lcid,
(srb_flagP) ? "SRB" : "DRB");
}
free(rlc_union_p);
return RLC_OP_STATUS_OK;
}
......
......@@ -2881,7 +2881,6 @@ do_RRCConnectionSetup(
else
physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL;
physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo));
physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig));
// PDSCH
......@@ -3202,6 +3201,11 @@ do_RRCConnectionSetup(
LOG_D(RRC,"RRCConnectionSetup Encoded %zd bits (%zd bytes) \n",
enc_rval.encoded,(enc_rval.encoded+7)/8);
free(mac_MainConfig->phr_Config);
free(maxHARQ_Tx);
free(periodicBSR_Timer);
free(mac_MainConfig->ul_SCH_Config);
free(rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.mac_MainConfig);
return((enc_rval.encoded+7)/8);
}
......@@ -4114,6 +4118,25 @@ uint16_t do_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
// for (i=0;i<30;i++)
// msg("%x.",buffer[i]);
// msg("\n");
if (securityConfigHO != NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.securityConfigHO);
}
if (mobilityInfo !=NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo);
}
if (MeasId_list != NULL) {
if(speedStatePars != NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars);
}
if (quantityConfig!=NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig);
}
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig);
}
if (mac_MainConfig!=NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig);
}
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated);
return((enc_rval.encoded+7)/8);
}
......
......@@ -1280,6 +1280,12 @@ void release_UE_in_freeList(module_id_t mod_id) {
ue_context_pP = rrc_eNB_get_ue_context(RC.rrc[mod_id],rnti);
if(ue_context_pP) {
if (ue_context_pP->ue_context.UE_Capability) {
LOG_I(RRC, "freeing old UE capabilities for UE %x\n", rnti);
ASN_STRUCT_FREE(asn_DEF_LTE_UE_EUTRA_Capability,
ue_context_pP->ue_context.UE_Capability);
ue_context_pP->ue_context.UE_Capability = 0;
}
rrc_eNB_remove_ue_context(&ctxt,RC.rrc[mod_id],
(struct rrc_eNB_ue_context_s *) ue_context_pP);
}
......@@ -1721,6 +1727,9 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
uint8_t next_xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id);
int ret = 0;
measurements_enabled = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2 ||
RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_measurement_reports;
ue_context_pP->ue_context.Status = RRC_CONNECTED;
ue_context_pP->ue_context.ue_rrc_inactivity_timer = 1; // set rrc inactivity when UE goes into RRC_CONNECTED
ue_context_pP->ue_context.reestablishment_xid = next_xid;
......@@ -1871,6 +1880,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
LOG_D(RRC, "set security successfully \n");
}
if(measurements_enabled){
// Measurement ID list
MeasId_list = CALLOC(1, sizeof(*MeasId_list));
memset((void *)MeasId_list, 0, sizeof(*MeasId_list));
......@@ -2053,6 +2063,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = meas_data->event6_config.reportInterval;
ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity;
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5);
}
// LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
#if 0
/* TODO: set a proper value.
......@@ -2071,6 +2082,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5;
Sparams->choice.setup.mobilityStateParameters.t_Evaluation = LTE_MobilityStateParameters__t_Evaluation_s60;
Sparams->choice.setup.mobilityStateParameters.t_HystNormal = LTE_MobilityStateParameters__t_HystNormal_s120;
if(measurements_enabled){
quantityConfig = CALLOC(1, sizeof(*quantityConfig));
memset((void *)quantityConfig, 0, sizeof(*quantityConfig));
quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct LTE_QuantityConfigEUTRA));
......@@ -2084,6 +2096,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)));
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = LTE_FilterCoefficient_fc4;
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = LTE_FilterCoefficient_fc4;
}
#if 0
LOG_I(RRC,
"[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n",
......@@ -2168,9 +2181,6 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
dedicatedInfoNASList = NULL;
}
measurements_enabled = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2 ||
RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_measurement_reports;
// send LTE_RRCConnectionReconfiguration
memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCConnectionReconfiguration(ctxt_pP,
......@@ -3131,6 +3141,9 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
uint8_t cc_id = ue_context_pP->ue_context.primaryCC_id;
LTE_UE_EUTRA_Capability_t *UEcap = ue_context_pP->ue_context.UE_Capability;
measurements_enabled = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2 ||
RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_measurement_reports;
#ifdef CBA // Contention Based Access
uint8_t *cba_RNTI_buf;
cba_RNTI = CALLOC(1, sizeof(LTE_C_RNTI_t));
......@@ -3574,7 +3587,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
} else {
LOG_E(RRC,"physical_config_dedicated not present in LTE_RRCConnectionReconfiguration. Not reconfiguring!\n");
}
if(measurements_enabled){
// Measurement ID list
MeasId_list = CALLOC(1, sizeof(*MeasId_list));
memset((void *)MeasId_list, 0, sizeof(*MeasId_list));
......@@ -3700,7 +3713,6 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = meas_data->event2_config.reportInterval;
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity;
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1);
//if (ho_state == 1 /*HO_MEASURMENT */ ) {
LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, and A5 event reporting\n",
ctxt_pP->module_id, ctxt_pP->frame);
ReportConfig_A2->reportConfigId = 3;
......@@ -3789,6 +3801,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
ue_context_pP->ue_context.measurement_info->events->a3_event->hysteresis = ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis;
ue_context_pP->ue_context.measurement_info->events->a3_event->timeToTrigger = ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger;
ue_context_pP->ue_context.measurement_info->events->a3_event->maxReportCells = ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells;
}
#if 0
/* TODO: set a proper value.
......@@ -3807,6 +3820,8 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5;
Sparams->choice.setup.mobilityStateParameters.t_Evaluation = LTE_MobilityStateParameters__t_Evaluation_s60;
Sparams->choice.setup.mobilityStateParameters.t_HystNormal = LTE_MobilityStateParameters__t_HystNormal_s120;
if(measurements_enabled){
quantityConfig = CALLOC(1, sizeof(*quantityConfig));
memset((void *)quantityConfig, 0, sizeof(*quantityConfig));
quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct LTE_QuantityConfigEUTRA));
......@@ -3823,6 +3838,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
ue_context_pP->ue_context.measurement_info->filterCoefficientRSRP = *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP;
ue_context_pP->ue_context.measurement_info->filterCoefficientRSRQ = *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ;
}
/* Initialize NAS list */
dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
......@@ -3857,9 +3873,6 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
dedicatedInfoNASList = NULL;
}
measurements_enabled = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2 ||
RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_measurement_reports;
memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCConnectionReconfiguration(ctxt_pP,
......@@ -3935,7 +3948,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
free(Sparams);
Sparams = NULL;
if(measurements_enabled){
free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP);
quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = NULL;
......@@ -3947,6 +3960,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
free(quantityConfig);
quantityConfig = NULL;
}
}
//-----------------------------------------------------------------------------
......@@ -5293,6 +5307,7 @@ void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_re
ue_context_target_p->ue_context.Status = RRC_HO_EXECUTION;
ue_context_target_p->ue_context.handover_info->state = HO_ACK;
free(ho);
}
void rrc_eNB_process_handoverCommand(
......@@ -5330,6 +5345,7 @@ void rrc_eNB_process_handoverCommand(
memcpy(ue_context->ue_context.handover_info->buf, buf, size);
ue_context->ue_context.handover_info->size = size;
free(ho);
}
void rrc_eNB_handover_ue_context_release(
......@@ -8036,6 +8052,7 @@ rrc_eNB_decode_ccch(
0,0
) == -1) {
LOG_E(RRC, "rrc_rlc_config_asn1_req failed\n");
ASN_STRUCT_FREE(asn_DEF_LTE_UL_CCCH_Message,ul_ccch_msg);
return -1;
}
}
......@@ -8076,6 +8093,7 @@ rrc_eNB_decode_ccch(
if(rrcConnectionRequest->ue_Identity.choice.randomValue.size != 5) {
LOG_I(RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %lu",
(long unsigned int)rrcConnectionRequest->ue_Identity.choice.randomValue.size);
ASN_STRUCT_FREE(asn_DEF_LTE_UL_CCCH_Message,ul_ccch_msg);
return -1;
}
......@@ -8225,6 +8243,7 @@ rrc_eNB_decode_ccch(
if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) {
if (rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti) == -1) {
LOG_E(RRC, "rrc_mac_remove_ue failed\n");
ASN_STRUCT_FREE(asn_DEF_LTE_UL_CCCH_Message,ul_ccch_msg);
return -1;
}
}
......@@ -8237,6 +8256,7 @@ rrc_eNB_decode_ccch(
F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = 0;
itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m);
}
ASN_STRUCT_FREE(asn_DEF_LTE_UL_CCCH_Message,ul_ccch_msg);
return -1;
}
}
......@@ -8301,6 +8321,7 @@ rrc_eNB_decode_ccch(
#endif
) == -1) {
LOG_E(RRC, "rrc_rlc_config_asn1_req failed\n");
ASN_STRUCT_FREE(asn_DEF_LTE_UL_CCCH_Message,ul_ccch_msg);
return -1;
}
}
......@@ -8320,7 +8341,7 @@ rrc_eNB_decode_ccch(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
rval = -1;
}
ASN_STRUCT_FREE(asn_DEF_LTE_UL_CCCH_Message,ul_ccch_msg);
return rval;
}
......@@ -8464,6 +8485,7 @@ rrc_eNB_decode_dcch(
if(NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
LOG_E(RRC,"CU cannot decode DCCH: no access to RC.mac[]\n");
ASN_STRUCT_FREE(asn_DEF_LTE_UL_DCCH_Message,ul_dcch_msg);
return -1;
}
......@@ -8627,11 +8649,13 @@ rrc_eNB_decode_dcch(
LOG_I(RRC,"issue rrc_eNB_send_PATH_SWITCH_REQ \n");
if (rrc_eNB_send_PATH_SWITCH_REQ(ctxt_pP,ue_context_p) == -1) {
LOG_E(RRC, "rrc_eNB_send_PATH_SWITCH_REQ failed\n");
ASN_STRUCT_FREE(asn_DEF_LTE_UL_DCCH_Message,ul_dcch_msg);
return -1;
}
}
} /* EPC_MODE_ENABLED */
ASN_STRUCT_FREE(asn_DEF_LTE_UL_DCCH_Message,ul_dcch_msg);
break;
case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete:
......@@ -8747,6 +8771,7 @@ rrc_eNB_decode_dcch(
LTE_RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) {
if(NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) {
LOG_E(RRC,"should not be reached in DU\n");
ASN_STRUCT_FREE(asn_DEF_LTE_UL_DCCH_Message,ul_dcch_msg);
return -1;
}
......@@ -8811,6 +8836,7 @@ rrc_eNB_decode_dcch(
rrc_eNB_generate_UECapabilityEnquiry(
ctxt_pP,
ue_context_p);
ASN_STRUCT_FREE(asn_DEF_LTE_UL_DCCH_Message,ul_dcch_msg);
break;
case LTE_UL_DCCH_MessageType__c1_PR_securityModeFailure:
......@@ -8842,6 +8868,7 @@ rrc_eNB_decode_dcch(
// followup with the remaining procedure
//#warning "LG Removed rrc_eNB_generate_UECapabilityEnquiry after receiving securityModeFailure"
rrc_eNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p);
ASN_STRUCT_FREE(asn_DEF_LTE_UL_DCCH_Message,ul_dcch_msg);
break;
case LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation:
......@@ -9012,9 +9039,9 @@ rrc_eNB_decode_dcch(
LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message %s:%u\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
__FILE__, __LINE__);
ASN_STRUCT_FREE(asn_DEF_LTE_UL_DCCH_Message,ul_dcch_msg);
return -1;
}
return 0;
//TTN for D2D
} else if (ul_dcch_msg->message.present == LTE_UL_DCCH_MessageType_PR_messageClassExtension) {
......@@ -9059,9 +9086,10 @@ rrc_eNB_decode_dcch(
LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown error %s:%u\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
__FILE__, __LINE__);
ASN_STRUCT_FREE(asn_DEF_LTE_UL_DCCH_Message,ul_dcch_msg);
return -1;
}
ASN_STRUCT_FREE(asn_DEF_LTE_UL_DCCH_Message,ul_dcch_msg);
return 0;
}
......
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