From c6e389ed4cb4a8b9db8ed6ead401ef798aa31823 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 19 Dec 2019 10:13:16 +0100 Subject: [PATCH] FlexRAN: assert if out of memory --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 1a8c2cefa8..c489f10dae 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -693,8 +693,7 @@ int flexran_agent_mac_stats_reply_cell(mid_t mod_id, // TODO: Fill in the actual noise and interference report for this cell Protocol__FlexNoiseInterferenceReport *ni_report; ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport)); - if(ni_report == NULL) - goto error; + AssertFatal(ni_report, "cannot malloc() ni_report\n"); protocol__flex_noise_interference_report__init(ni_report); ni_report->sfn_sf = flexran_get_sfn_sf(mod_id); ni_report->has_sfn_sf = 1; @@ -709,21 +708,6 @@ int flexran_agent_mac_stats_reply_cell(mid_t mod_id, } } return 0; - - error: - if (cell_report != NULL) { - if (n_cc > 0) { - for (int i = 0; i < n_cc; i++) { - if (cell_report[i]->noise_inter_report != NULL) { - free(cell_report[i]->noise_inter_report); - cell_report[i]->noise_inter_report = NULL; - } - } - } - free(cell_report); - cell_report = NULL; - } - return -1; } int flexran_agent_mac_destroy_stats_reply(Protocol__FlexStatsReply *reply) {