From fdb47bed67d3ce34febbf96e953a65438b79fd55 Mon Sep 17 00:00:00 2001 From: Dong Anyuan <donganyuan@cn.fujitsu.com> Date: Thu, 20 Jun 2019 10:59:59 +0900 Subject: [PATCH] Fix Coverity Scan CID 300383 (Variable sl_CommConfig going out of scope leaks the storage it points to.) --- openair2/RRC/LTE/rrc_eNB.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 46a7c287e4..7b70c9564e 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -8257,9 +8257,10 @@ rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink( LTE_SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool( const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, LTE_SL_DestinationInfoList_r12_t *destinationInfoList ) { // for the moment, use scheduled resource allocation - LTE_SL_CommConfig_r12_t *sl_CommConfig; + LTE_SL_CommConfig_r12_t sl_CommConfig_r12; + LTE_SL_CommConfig_r12_t *sl_CommConfig = &sl_CommConfig_r12; LTE_SL_CommResourcePool_r12_t *sc_CommTxConfig; - sl_CommConfig = CALLOC(1, sizeof(struct LTE_SL_CommConfig_r12)); + memset(sl_CommConfig,0,sizeof(LTE_SL_CommConfig_r12_t)); sl_CommConfig->commTxResources_r12 = CALLOC(1, sizeof(*sl_CommConfig->commTxResources_r12)); sl_CommConfig->commTxResources_r12->present = LTE_SL_CommConfig_r12__commTxResources_r12_PR_setup; sl_CommConfig->commTxResources_r12->choice.setup.present = LTE_SL_CommConfig_r12__commTxResources_r12__setup_PR_scheduled_r12; -- 2.26.2