diff --git a/common/utils/T/tracer/textlog.c b/common/utils/T/tracer/textlog.c index 60e5092600..6ead65d87a 100644 --- a/common/utils/T/tracer/textlog.c +++ b/common/utils/T/tracer/textlog.c @@ -122,6 +122,8 @@ int main(int n, char **v) socket = connect_to(ip, port); if (socket == -1) { printf("fatal: connection failed\n"); + free(on_off_name); + free(on_off_action); return 1; } diff --git a/executables/create_tasks_ue.c b/executables/create_tasks_ue.c index 728e4546b5..4cffef909d 100644 --- a/executables/create_tasks_ue.c +++ b/executables/create_tasks_ue.c @@ -34,7 +34,8 @@ #include "RRC/LTE/rrc_defs.h" # include "enb_app.h" -int create_tasks_ue(uint32_t ue_nb) { +int create_tasks_ue(uint32_t ue_nb) +{ LOG_D(ENB_APP, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb); itti_wait_ready(1); @@ -50,6 +51,7 @@ int create_tasks_ue(uint32_t ue_nb) { ittiTask_parms_t parms = {users, NULL}; if (itti_create_task(TASK_NAS_UE, nas_ue_task, &parms) < 0) { LOG_E(NAS, "Create task for NAS UE failed\n"); + free(users); return -1; } } diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index ac2c453fc5..e095f9aeb3 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -917,6 +917,11 @@ int main(int argc, char **argv) csv_file = fopen(filename_csv, "a"); if (csv_file == NULL) { printf("Can't open file \"%s\", errno %d\n", filename_csv, errno); + free(s_re); + free(s_im); + free(r_re); + free(r_im); + free(txdata); return 1; } // adding name of parameters into file diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 374234e55d..53af58e03b 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -902,6 +902,10 @@ int main(int argc, char *argv[]) csv_file = fopen(filename_csv, "a"); if (csv_file == NULL) { printf("Can't open file \"%s\", errno %d\n", filename_csv, errno); + free(s_re); + free(s_im); + free(r_re); + free(r_im); return 1; } // adding name of parameters into file diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 3715c0ae5d..fe4f38f39c 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -1309,7 +1309,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(sctp_assoc_t assoc_id, f1ap_ue_cont /* procedureCode */ if (0) { ie11->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); - ie11->value.choice.CriticalityDiagnostics.procedureCode = 0L; + *ie11->value.choice.CriticalityDiagnostics.procedureCode = 0L; } /* optional */ @@ -1330,7 +1330,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(sctp_assoc_t assoc_id, f1ap_ue_cont /* transactionID */ if (0) { ie11->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); - ie11->value.choice.CriticalityDiagnostics.transactionID = 0L; + *ie11->value.choice.CriticalityDiagnostics.transactionID = 0L; } /* optional */ diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 176b5b8e7b..d07fdbfad1 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -4274,11 +4274,8 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD void fill_coresetZero(NR_ControlResourceSet_t *coreset0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config) { - if (coreset0 == NULL) - coreset0 = calloc(1,sizeof(*coreset0)); - - AssertFatal(type0_PDCCH_CSS_config!=NULL,"No type0 CSS configuration\n"); - + AssertFatal(type0_PDCCH_CSS_config, "No type0 CSS configuration\n"); + AssertFatal(coreset0, "Coreset0 should have been allocated outside of this function\n"); coreset0->controlResourceSetId = 0; int duration = type0_PDCCH_CSS_config->num_symbols; @@ -4327,8 +4324,7 @@ void fill_searchSpaceZero(NR_SearchSpace_t *ss0, int slots_per_frame, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config) { - if(ss0 == NULL) - ss0 = calloc(1, sizeof(*ss0)); + AssertFatal(ss0, "SearchSpace0 should have been allocated outside of this function\n"); if(ss0->controlResourceSetId == NULL) ss0->controlResourceSetId = calloc(1, sizeof(*ss0->controlResourceSetId)); if(ss0->monitoringSymbolsWithinSlot == NULL) diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 069b6d8e7b..b9920dd085 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -1351,8 +1351,7 @@ static void config_downlinkBWP(NR_BWP_Downlink_t *bwp, bwp->bwp_Common->pdcch_ConfigCommon=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon)); bwp->bwp_Common->pdcch_ConfigCommon->present = NR_SetupRelease_PDCCH_ConfigCommon_PR_setup; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup = calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup)); - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero=NULL; - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet)); + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero = NULL; int curr_bwp = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,MAX_BWP_SIZE); @@ -1400,7 +1399,6 @@ static void config_downlinkBWP(NR_BWP_Downlink_t *bwp, NR_ControlResourceSet_t *coreset2 = get_coreset_config(bwp->bwp_Id, curr_bwp, ssb_bitmap); asn1cSeqAdd(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list, coreset2); - bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList)); NR_SearchSpace_t *ss2 = rrc_searchspace_config(false, 10+bwp->bwp_Id, coreset2->controlResourceSetId); asn1cSeqAdd(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, ss2); @@ -1657,9 +1655,6 @@ static void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, int rep_id, int uid) { - NR_CSI_ReportConfig_t *csirep = calloc(1, sizeof(*csirep)); - csirep->reportConfigId = rep_id; - csirep->carrier = NULL; int resource_id = -1; int im_id = -1; for (int csi_list = 0; csi_list < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_list++) { @@ -1678,6 +1673,9 @@ static void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, // if there are no associated resources, do not configure if (resource_id < 0 || im_id < 0) return; + NR_CSI_ReportConfig_t *csirep = calloc(1, sizeof(*csirep)); + csirep->reportConfigId = rep_id; + csirep->carrier = NULL; csirep->resourcesForChannelMeasurement = resource_id; csirep->csi_IM_ResourcesForInterference = calloc(1, sizeof(*csirep->csi_IM_ResourcesForInterference)); *csirep->csi_IM_ResourcesForInterference = im_id; @@ -1721,9 +1719,6 @@ static void config_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, int uid, int num_antenna_ports) { - NR_CSI_ReportConfig_t *csirep = calloc(1, sizeof(*csirep)); - csirep->reportConfigId = rep_id; - csirep->carrier = NULL; int resource_id = -1; for (int csi_list = 0; csi_list < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_list++) { NR_CSI_ResourceConfig_t *csires = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_list]; @@ -1740,6 +1735,9 @@ static void config_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, // if there are no associated resources, do not configure if (resource_id < 0) return; + NR_CSI_ReportConfig_t *csirep = calloc(1, sizeof(*csirep)); + csirep->reportConfigId = rep_id; + csirep->carrier = NULL; csirep->resourcesForChannelMeasurement = resource_id; csirep->csi_IM_ResourcesForInterference = NULL; csirep->nzp_CSI_RS_ResourcesForInterference = NULL; @@ -2027,7 +2025,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, c asn1cCalloc(P0->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, Z8); asn1cSequenceAdd(Z8->list, long, ZoneEight); - asn1cCallocOne(ZoneEight, 0); + *ZoneEight = 0; asn1cCalloc(ServCellCom->uplinkConfigCommon, UL); asn_set_empty(&UL->frequencyInfoUL.scs_SpecificCarrierList.list); @@ -2289,9 +2287,6 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, asn1cSeqAdd(&bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list, coreset); - bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList = - calloc(1, sizeof(*bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList)); - NR_SearchSpace_t *ss2 = rrc_searchspace_config(false, 5, coreset->controlResourceSetId); asn1cSeqAdd(&bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, ss2);