From 736c3b988b0cc9814b696176a49086f40d844e1a Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:12:16 +0900 Subject: [PATCH] Fix Coverity Scan CID 300499 (Variable paging_report going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 b38304742b..a5742a5d43 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -407,14 +407,18 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, //Provide a report for each pending paging message Protocol__FlexPagingInfo **p_info; p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * paging_report->n_paging_info); - if (p_info == NULL) + if (p_info == NULL){ + free(paging_report); goto error; + } for (j = 0; j < paging_report->n_paging_info; j++) { p_info[j] = malloc(sizeof(Protocol__FlexPagingInfo)); - if(p_info[j] == NULL) + if(p_info[j] == NULL){ + free(paging_report); goto error; + } protocol__flex_paging_info__init(p_info[j]); //TODO: Set paging index. This index is the same that will be used for the scheduling of the //paging message by the controller