From 401002738088efaea5e69fcd89d075d12cb946d4 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Thu, 20 Jun 2019 10:58:21 +0900 Subject: [PATCH] Fix Coverity Scan CID 300384 (Variable rrc_measurements going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index aa7a402f2b..fc8a9ba337 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -400,8 +400,11 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, /* Target Cell, Neghibouring*/ Protocol__FlexNeighCellsMeasurements *neigh_meas; neigh_meas = malloc(sizeof(Protocol__FlexNeighCellsMeasurements)); - if (neigh_meas == NULL) + if (neigh_meas == NULL) { + free(rrc_measurements); + rrc_measurements = NULL; goto error; + } protocol__flex_neigh_cells_measurements__init(neigh_meas); @@ -414,6 +417,8 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, eutra_meas = malloc(sizeof(Protocol__FlexEutraMeasurements) * neigh_meas->n_eutra_meas); if (eutra_meas == NULL) { free(neigh_meas); + free(rrc_measurements); + rrc_measurements = NULL; goto error; } @@ -426,6 +431,8 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, } free(eutra_meas); free(neigh_meas); + free(rrc_measurements); + rrc_measurements = NULL; goto error; }