From 32bb6c9ebf47f02958e1f22e1f5d89afab1329d9 Mon Sep 17 00:00:00 2001 From: Dong Anyuan <donganyuan@cn.fujitsu.com> Date: Thu, 30 May 2019 19:10:05 +0900 Subject: [PATCH] ReFix Coverity Scan CID 300428 (Variable dl_info going out of scope leaks the storage it points to.) --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 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 d3c9f8d300..97c3b0b3f0 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1041,11 +1041,17 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle if (header != NULL) free(header); if (sf_trigger_msg != NULL) { - for (i = 0; i < sf_trigger_msg->n_dl_info; i++) { - free(sf_trigger_msg->dl_info[i]->harq_status); - free(sf_trigger_msg->dl_info[i]); + if (sf_trigger_msg->dl_info != NULL) { + for (i = 0; i < sf_trigger_msg->n_dl_info; i++) { + if (sf_trigger_msg->dl_info[i] != NULL) { + if (sf_trigger_msg->dl_info[i]->harq_status != NULL) { + free(sf_trigger_msg->dl_info[i]->harq_status); + } + free(sf_trigger_msg->dl_info[i]); + } + } + free(sf_trigger_msg->dl_info); } - free(sf_trigger_msg->dl_info); if (sf_trigger_msg->ul_info != NULL) { for (i = 0; i < sf_trigger_msg->n_ul_info; i++) { if (sf_trigger_msg->ul_info[i] != NULL) { -- GitLab