valgrind memory leak fixes 53/5353/11
authorsphoorthi <sphoorthi.dayanand@radisys.com>
Tue, 15 Dec 2020 11:16:39 +0000 (16:46 +0530)
committersphoorthi <sphoorthi.dayanand@radisys.com>
Wed, 6 Jan 2021 11:24:08 +0000 (16:54 +0530)
Change-Id: I663d70485acf099af169aee53ca3bd72ec9c1ea3
Signed-off-by: sphoorthi <sphoorthi.dayanand@radisys.com>
23 files changed:
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/lwr_mac_handle_phy.c
src/5gnrmac/lwr_mac_phy.c
src/5gnrmac/lwr_mac_util.c
src/5gnrmac/mac_cfg_hdl.c
src/5gnrmac/mac_demux.c
src/5gnrmac/mac_msg_hdl.c
src/5gnrmac/mac_mux.c
src/5gnrmac/mac_slot_ind.c
src/5gnrmac/mac_ue_mgr.c
src/cm/cm_gen.c
src/cm/cm_inet.c
src/cm/cm_lib.c
src/cu_stub/cu_f1ap_msg_hdl.c
src/du_app/du_cell_mgr.c
src/du_app/du_e2ap_msg_hdl.c
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_msg_hdl.c
src/du_app/du_sctp.c
src/mt/mt_ss.c
src/mt/ss_msg.c
src/mt/ss_task.c
src/phy_stub/l1_bdy1.c

index a10a524..af03dce 100644 (file)
@@ -2463,24 +2463,24 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo)
 {
    if(dlDciPtr != NULLP)
    {
-      uint8_t numBytes;
-      uint8_t bytePos;
-      uint8_t bitPos;
-
-      uint16_t coreset0Size;
-      uint16_t rbStart;
-      uint16_t rbLen;
-      uint32_t freqDomResAssign;
-      uint32_t timeDomResAssign;
-      uint8_t  VRB2PRBMap;
-      uint32_t modNCodScheme;
-      uint8_t  redundancyVer;
-      uint32_t sysInfoInd;
-      uint32_t reserved;
+      uint8_t numBytes=0;
+      uint8_t bytePos=0;
+      uint8_t bitPos=0;
+
+      uint16_t coreset0Size=0;
+      uint16_t rbStart=0;
+      uint16_t rbLen=0;
+      uint32_t freqDomResAssign=0;
+      uint32_t timeDomResAssign=0;
+      uint8_t  VRB2PRBMap=0;
+      uint32_t modNCodScheme=0;
+      uint8_t  redundancyVer=0;
+      uint32_t sysInfoInd=0;
+      uint32_t reserved=0;
 
       /* Size(in bits) of each field in DCI format 0_1 
        * as mentioned in spec 38.214 */
-      uint8_t freqDomResAssignSize;
+      uint8_t freqDomResAssignSize = 0;
       uint8_t timeDomResAssignSize = 4;
       uint8_t VRB2PRBMapSize       = 1;
       uint8_t modNCodSchemeSize    = 5;
@@ -2603,22 +2603,22 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo)
 {
    if(dlDciPtr != NULLP)
    {
-      uint8_t numBytes;
-      uint8_t bytePos;
-      uint8_t bitPos;
+      uint8_t numBytes =0;
+      uint8_t bytePos =0;
+      uint8_t bitPos =0;
 
-      uint16_t coreset0Size;
-      uint16_t rbStart;
-      uint16_t rbLen;
-      uint32_t freqDomResAssign;
-      uint8_t timeDomResAssign;
-      uint8_t  VRB2PRBMap;
-      uint8_t modNCodScheme;
-      uint8_t tbScaling;
-      uint32_t reserved;
+      uint16_t coreset0Size =0;
+      uint16_t rbStart =0;
+      uint16_t rbLen =0;
+      uint32_t freqDomResAssign =0;
+      uint8_t timeDomResAssign =0;
+      uint8_t  VRB2PRBMap =0;
+      uint8_t modNCodScheme =0;
+      uint8_t tbScaling =0;
+      uint32_t reserved =0;
 
       /* Size(in bits) of each field in DCI format 1_0 */
-      uint8_t freqDomResAssignSize;
+      uint8_t freqDomResAssignSize = 0;
       uint8_t timeDomResAssignSize = 4;
       uint8_t VRB2PRBMapSize       = 1;
       uint8_t modNCodSchemeSize    = 5;
@@ -3304,10 +3304,10 @@ uint8_t fillDlMsgTxDataReq(fapi_tx_pdu_desc_t *pduDesc, DlMsgInfo *dlMsgInfo,
 uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo)
 {
 #ifdef INTEL_FAPI
-   uint8_t idx;
+   uint8_t idx =0;
    uint8_t nPdu = 0;
    uint8_t numPduEncoded = 0;
-   uint16_t cellIdx;
+   uint16_t cellIdx =0;
    uint16_t pduIndex = 0;
 
    SlotIndInfo dlTtiReqTimingInfo;
@@ -3315,7 +3315,7 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo)
    MacCellCfg macCellCfg;
    RntiType rntiType;
    fapi_dl_tti_req_t *dlTtiReq = NULLP;
-   fapi_msg_header_t *msgHeader;
+   fapi_msg_header_t *msgHeader = NULLP;
    p_fapi_api_queue_elem_t dlTtiElem;
    p_fapi_api_queue_elem_t headerElem;
 
@@ -3513,10 +3513,10 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo)
    uint8_t nPdu = 0;
    uint16_t cellIdx;
    uint16_t pduIndex = 0;
-   fapi_tx_data_req_t       *txDataReq;
-   fapi_msg_header_t        *msgHeader;
-   p_fapi_api_queue_elem_t  txDataElem;
-   p_fapi_api_queue_elem_t  headerElem;
+   fapi_tx_data_req_t       *txDataReq =NULLP;
+   fapi_msg_header_t        *msgHeader =NULLP;
+   p_fapi_api_queue_elem_t  txDataElem = 0;
+   p_fapi_api_queue_elem_t  headerElem =0;
 
    GET_CELL_IDX(currTimingInfo.cellId, cellIdx);
 
@@ -3873,13 +3873,13 @@ void fillPucchPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg,\
 uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo)
 {
 #ifdef INTEL_FAPI
-   uint16_t   cellIdx;
+   uint16_t   cellIdx =0;
    uint8_t    pduIdx = -1;
    SlotIndInfo ulTtiReqTimingInfo;
    MacUlSlot *currUlSlot = NULLP;
    MacCellCfg macCellCfg;
    fapi_ul_tti_req_t *ulTtiReq = NULLP;
-   fapi_msg_header_t *msgHeader;
+   fapi_msg_header_t *msgHeader = NULLP;
    p_fapi_api_queue_elem_t ulTtiElem;
    p_fapi_api_queue_elem_t headerElem;
 
@@ -3984,19 +3984,19 @@ void fillUlDciPdu(fapi_dl_dci_t *ulDciPtr, DciInfo *schDciInfo)
 {
    if(ulDciPtr != NULLP)
    {
-      uint8_t numBytes;
-      uint8_t bytePos;
-      uint8_t bitPos;
+      uint8_t numBytes =0;
+      uint8_t bytePos =0;
+      uint8_t bitPos =0;
 
       uint8_t  coreset1Size = 0;
       uint16_t rbStart = 0;
       uint16_t rbLen = 0;
       uint8_t  dciFormatId = 0;
-      uint32_t freqDomResAssign;
-      uint8_t  timeDomResAssign;
-      uint8_t  freqHopFlag;
-      uint8_t  modNCodScheme;
-      uint8_t  ndi;
+      uint32_t freqDomResAssign =0;
+      uint8_t  timeDomResAssign =0;
+      uint8_t  freqHopFlag =0;
+      uint8_t  modNCodScheme =0;
+      uint8_t  ndi =0;
       uint8_t  redundancyVer = 0;
       uint8_t  harqProcessNum = 0;
       uint8_t  puschTpc = 0;
@@ -4179,12 +4179,12 @@ uint8_t fillUlDciPdcchPdu(fapi_dci_pdu_t *ulDciReqPdu, DlSchedInfo *dlInfo, uint
 uint16_t fillUlDciReq(SlotIndInfo currTimingInfo)
 {
 #ifdef INTEL_FAPI
-   uint8_t      cellIdx;
+   uint8_t      cellIdx =0;
    uint8_t      numPduEncoded = 0;
-   SlotIndInfo  ulDciReqTimingInfo;
+   SlotIndInfo  ulDciReqTimingInfo ={0};
    MacDlSlot    *currDlSlot = NULLP;
-   fapi_ul_dci_req_t        *ulDciReq;
-   fapi_msg_header_t        *msgHeader;
+   fapi_ul_dci_req_t        *ulDciReq =NULLP;
+   fapi_msg_header_t        *msgHeader =NULLP;
    p_fapi_api_queue_elem_t  ulDciElem;
    p_fapi_api_queue_elem_t  headerElem;
 
index 9e6d675..28a0ea2 100644 (file)
@@ -105,8 +105,8 @@ uint8_t procSlotInd(fapi_slot_ind_t *fapiSlotInd)
 {
    /* fill Pst structure to send to lwr_mac to MAC */
    Pst pst;
-   uint16_t ret;
-   SlotIndInfo *slotInd;
+   uint16_t ret = 0;
+   SlotIndInfo *slotInd = {0};
 
    MAC_ALLOC_SHRABL_BUF(slotInd, sizeof(SlotIndInfo));
    if(slotInd)
@@ -309,7 +309,7 @@ uint8_t procCrcInd(fapi_crc_ind_t  *fapiCrcInd)
 uint8_t procRxDataInd(fapi_rx_data_indication_t  *fapiRxDataInd)
 {
    Pst           pst;
-   uint8_t       pduIdx;
+   uint8_t       pduIdx =0;
    RxDataInd     *rxDataInd = NULLP;
    RxDataIndPdu  *pdu = NULLP;   
 
@@ -488,7 +488,7 @@ void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg)
 {
 #ifdef INTEL_FAPI
    /* extract the header */
-   fapi_msg_t *header;
+   fapi_msg_t *header = NULLP;
    header = (fapi_msg_t *)msg;
 
    switch(header->msg_id)
@@ -522,7 +522,7 @@ void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg)
               lwrMacCb.cellCb[0].state = PHY_STATE_RUNNING;
            }
 
-           fapi_slot_ind_t *slotInd;
+           fapi_slot_ind_t *slotInd = NULLP;
            slotInd  = (fapi_slot_ind_t *)msg;
            procSlotInd(slotInd);
            break;
index c927a5c..c1aa4db 100644 (file)
@@ -137,8 +137,8 @@ void LwrMacEnqueueWlsBlock()
  * ****************************************************************/
 void addWlsBlockToFree(void *msg, uint32_t msgLen, uint8_t idx)
 {
-   CmLList         *node;
-   WlsBlockToFree  *block;
+   CmLList         *node = NULLP;
+   WlsBlockToFree  *block = NULLP;
    MAC_ALLOC(block, sizeof(WlsBlockToFree));
    if(block)
    {
@@ -272,7 +272,7 @@ uint8_t LwrMacSendToL1(void *msg)
 {
    uint8_t ret = ROK;
 #ifdef INTEL_FAPI
-   uint16_t msgLen;
+   uint16_t msgLen =0;
    p_fapi_api_queue_elem_t currMsg = NULLP;
 
 #ifdef INTEL_WLS_MEM
index 9e18003..6dfddc2 100644 (file)
@@ -74,11 +74,11 @@ LwrMacCellCb * lwrMacGetCellCb
 uint32_t reverseBits(uint32_t num, uint8_t numBits)
 {
    uint32_t reverse_num = 0;
-   int i;
-   for (i = 0; i < numBits; i++)
+   uint8_t bitIdx;
+   for (bitIdx = 0; bitIdx < numBits; bitIdx++)
    {
-      if((num & (1 << i)))
-        reverse_num |= 1 << ((numBits - 1) - i);
+      if((num & (1 << bitIdx)))
+        reverse_num |= 1 << ((numBits - 1) - bitIdx);
    }
    return reverse_num;
 }
index 41e82c9..3fbd355 100644 (file)
@@ -193,9 +193,10 @@ uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
 {
    SchCellCfg schCellCfg;
    Pst        cfgPst;
-   uint8_t    ret;
+   uint8_t    ret =0;
 
    memset(&cfgPst, 0, sizeof(Pst));
+   memset(&schCellCfg, 0, sizeof(SchCellCfg));
    schCellCfg.cellId = macCellCfg->cellId;
    schCellCfg.phyCellId = macCellCfg->phyCellId;
    schCellCfg.bandwidth = macCellCfg->dlCarrCfg.bw;
index 733b197..7dbf665 100644 (file)
  * ****************************************************************/
 uint8_t unpackRxData(uint16_t cellId, SlotIndInfo slotInfo, RxDataIndPdu *rxDataIndPdu)
 {
-   uint8_t   ueIdx;       /* Iterator for UE list */
-   uint8_t   lcId;        /* LC ID of a sub pdu */
-   uint8_t   fBit = 0;    /* Value of F Bit in MAC sub-header */
-   uint8_t   idx = 0;     /* Iterator for received PDU */
-   uint16_t  length;      /* Length of payload in a sub-PDU */ 
-   uint8_t   *pdu;        /* Payload in sub-PDU */
-   uint16_t  pduLen;      /* Length of undecoded PDU */
-   uint8_t   *rxDataPdu;  /* Received PDU in Rx Data Ind */
-   uint16_t  cellIdx;     /* Cell Index */
+   uint8_t   ueIdx = 0;       /* Iterator for UE list */
+   uint8_t   lcId = 0;        /* LC ID of a sub pdu */
+   uint8_t   fBit = 0;        /* Value of F Bit in MAC sub-header */
+   uint8_t   idx = 0;         /* Iterator for received PDU */
+   uint16_t  length = 0;      /* Length of payload in a sub-PDU */ 
+   uint8_t   *pdu = NULLP;    /* Payload in sub-PDU */
+   uint16_t  pduLen = 0;      /* Length of undecoded PDU */
+   uint8_t   *rxDataPdu = NULLP;  /* Received PDU in Rx Data Ind */
+   uint16_t  cellIdx = 0;     /* Cell Index */
    uint8_t   ret =ROK;
 
    GET_CELL_IDX(cellId, cellIdx);
index aef583b..694cd74 100644 (file)
@@ -210,12 +210,13 @@ uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
  * ****************************************************************/
 uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData)
 {
-   uint8_t   pduIdx;
-   uint8_t   *txPdu;
-   uint16_t  tbSize;
+   uint8_t   pduIdx =0;
+   uint8_t   *txPdu =NULLP;
+   uint16_t  tbSize =0;
    MacDlData macDlData;
    MacDlSlot *currDlSlot = NULLP;
-
+  
+   memset(&macDlData , 0, sizeof(MacDlData));
    DU_LOG("\nMAC: Received DL data for sfn=%d slot=%d", \
       dlData->slotInfo.sfn, dlData->slotInfo.slot);
    /* Copy the pdus to be muxed into mac Dl data */
index 8017f57..a726395 100644 (file)
@@ -286,8 +286,8 @@ void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *txPdu, uint16_t
 
    /* subheader fields */
    uint8_t RBit = 0;              /* Reserved bit */
-   uint8_t FBit;                  /* Format Indicator */
-   uint8_t lcid;                  /* LCID */
+   uint8_t FBit =0;                  /* Format Indicator */
+   uint8_t lcid =0;                  /* LCID */
    uint16_t lenField = 0;         /* Length field */
 
    /* subheader field size (in bits) */
index 6bc961b..a58a1b7 100644 (file)
@@ -299,7 +299,7 @@ int sendCellUpIndMacToDuApp(uint16_t cellId)
  * ****************************************************************/
 uint8_t macProcSlotInd(SlotIndInfo slotInd)
 {
-   uint16_t  cellIdx;
+   uint16_t  cellIdx = 0;
 
    GET_CELL_IDX(slotInd.cellId, cellIdx);
 
index 5f246ec..0f38987 100644 (file)
@@ -638,7 +638,6 @@ void fillPucchPowerControl(PucchPowerControl *macPwrCtrl, SchPucchPowerControl *
 
 uint8_t fillOtherPucchFormatCfg(uint8_t pucchFormat, PucchFormatCfg *macFormatCfg, SchPucchCfg *schPucchCfg)
 {
-   uint8_t ret = ROK;
 
    switch(pucchFormat)
    {
@@ -702,6 +701,7 @@ uint8_t fillOtherPucchFormatCfg(uint8_t pucchFormat, PucchFormatCfg *macFormatCf
          DU_LOG("\nERROR --> MAC : Invalid Format Cfg %d in fillInitialUlBwpPucchCfg()", pucchFormat);
          return RFAILED;
    }
+   return ROK;
 }
 
 /*******************************************************************
index cb7c069..4fa4e20 100644 (file)
@@ -1619,13 +1619,13 @@ PTR *ptr,  /* duration structure */
 Buffer *mBuf    /* message buffer */
 )
 {
-   uint16_t tmp16;               /* temporary value */
-   uint32_t tmp32;               /* temporary value */
-   Data unpkArray[PTRSIZE]; /* unpacking array */
-   S16 ret;                 /* return code */
+   uint16_t tmp16 =0;               /* temporary value */
+   uint32_t tmp32 =0;               /* temporary value */
+   Data unpkArray[PTRSIZE];        /* unpacking array */
+   S16 ret =ROK;                 /* return code */
 
 #if (defined(ALPHA) || defined(BIT_64))
-   uint64_t tmp64;
+   uint64_t tmp64 =0;
 #endif
    
 
index 78c7640..f764f9c 100644 (file)
@@ -2307,21 +2307,20 @@ uint32_t        context       /* value to be passed back, if error occurs */
    MsgLen  msgLen = 0;              /* message length */    
    MsgLen  bufLen = 0;              /* send buffer length */     
    Data   *sendBuf = NULLP;             /* plain send buffer */
-   uint32_t     flags;
+   uint32_t     flags =0;
    CmInetSockAddr *sockAddrPtr = NULLP;
    /* cm_inet_c_001.main_58 : Fix for klockwork issue */
    MsgLen          sockAddrLen = 0; 
-   struct sockaddr_in  addr;
+   struct sockaddr_in  addr ={0};
 #ifdef IPV6_SUPPORTED
 #ifdef SUN_KSCTP
    S8     *addrString = NULLP;
    uint32_t    addrLen = 0;
    S8     ipv4Format[23] = "::ffff:";
-   CmInetIpAddr ipv4NetAddr;
+   CmInetIpAddr ipv4NetAddr = {0};
 #endif /* SUN_KSCTP */
-   struct sockaddr_in6  addr6;
+   struct sockaddr_in6  addr6 ={0};
 #endif /* IPV6_SUPPORTED */
-
 #if (ERRCLASS & ERRCLS_INT_PAR)
    /* error check on parameters */
    if ((sockFd == NULLP) || CM_INET_INV_SOCK_FD(sockFd)
@@ -4010,48 +4009,48 @@ S16             flags           /* additional control flags, unused */
 )
 {
 #if (defined(WIN32) || defined(CMINETFLATBUF))
-   S32     ret;                 /* temporary return value */
-   MsgLen  msgLen;              /* message length */ 
-   MsgLen  bufLen;              /* send buffer length */
-   Data   *sendBuf;             /* plain send buffer */
-#else
-   S32 ret;                     /* temporary return value */
-   S32 retVal;                  /* temporary return value */
-   S16 i;                       /* loop index */
-   CmInetIovec  txArr[CM_INET_MAX_DBUF]; /* scatter vector */
-   S16      numDBufs;           /* number of dBufs in message */
-   struct   msghdr msg;         /* sendmsg() message header */
-   MsgLen   msgLen;             /* message length */ 
-   uint32_t      strtEndDBufNum;     /* starting/ending DBuf number */ 
-   MsgLen   unSentLen;          /* sent len */
+   S32     ret =0;                 /* temporary return value */
+   MsgLen  msgLen =0;              /* message length */ 
+   MsgLen  bufLen =0;              /* send buffer length */
+   Data   *sendBuf =0;             /* plain send buffer */
+#else
+   S32 ret =0;                     /* temporary return value */
+   S32 retVal =0;                  /* temporary return value */
+   S16 i =0;                       /* loop index */
+   CmInetIovec  txArr[CM_INET_MAX_DBUF] = {0}; /* scatter vector */
+   S16      numDBufs =0;           /* number of dBufs in message */
+   struct   msghdr msg ={0};         /* sendmsg() message header */
+   MsgLen   msgLen =0;             /* message length */ 
+   uint32_t      strtEndDBufNum =0;     /* starting/ending DBuf number */ 
+   MsgLen   unSentLen =0;          /* sent len */
 #ifdef IPV6_SUPPORTED 
-   uint32_t    curMsgIdx;            /* indx in cmsgData where to write an ext hdr */
+   uint32_t    curMsgIdx =0;            /* indx in cmsgData where to write an ext hdr */
    /* added for IPv6 ext hdr */
 #if (defined(SS_LINUX) || defined(_XPG4_2))
    /* alloc from stack for IPv6 ancill data */
-   uint8_t     cmsgData[CM_INET_IPV6_ANCIL_DATA];
+   uint8_t     cmsgData[CM_INET_IPV6_ANCIL_DATA]= {0};
 #endif /* SS_LINUX || _XPG4_2 */
 #else
-   uint32_t    curMsgIdx;            /* indx in cmsgData where to write an ext hdr */
+   uint32_t    curMsgIdx =0;            /* indx in cmsgData where to write an ext hdr */
 #if (defined(SS_LINUX) || defined(_XPG4_2))
    /* alloc from stack for IPv4 ancill data */ 
-    uint8_t     cmsgData[CM_INET_IPV4_ANCIL_DATA];
+    uint8_t     cmsgData[CM_INET_IPV4_ANCIL_DATA]={0};
 #endif /* SS_LINUX || _XPG4_2 */
 #endif /* IPV6_SUPPORTED */   
 #endif /* WIN32 | CMINETFLATBUF */  
 
-   struct  sockaddr_in remAddr; /* remote Internet address */   
+   struct  sockaddr_in remAddr ={0}; /* remote Internet address */   
 #ifdef IPV6_SUPPORTED
-   struct   sockaddr_in6  remAddr6; /* remote Internet address */   
+   struct   sockaddr_in6  remAddr6 = {0}; /* remote Internet address */   
 #endif /* IPV8_SUPPORTED */
-   CmInetSockAddr *sockAddrPtr;
+   CmInetSockAddr *sockAddrPtr = NULLP;
    /* cm_inet_c_001.main_58 : Fix for klockwork issue */
-   uint32_t            sizeOfAddr;    
+   uint32_t            sizeOfAddr =0;    
 
    /* cm_inet_c_001.main_50 - Added for partial send handling */
    /* cm_inet_c_001.main_59: Protected under if not defined WIN32*/
 #if (!defined(WIN32)) 
-   MsgLen         ioLen; 
+   MsgLen         ioLen =0
 #endif
 
 
@@ -4506,7 +4505,7 @@ S16             flags           /* additional control flags, unused */
    S32 ret;                     /* temporary return value */
    S32 retVal;                  /* temporary return value */
    S16 i;                       /* loop index */
-   CmInetIovec  txArr[CM_INET_MAX_DBUF]; /* scatter vector */
+   CmInetIovec  txArr[CM_INET_MAX_DBUF] ={0}; /* scatter vector */
    S16      numDBufs;           /* number of dBufs in message */
    struct   msghdr msg;         /* sendmsg() message header */
    MsgLen   msgLen;             /* message length */ 
@@ -5700,51 +5699,51 @@ S32              flags          /* additional control flags */
 )
 {
 #if (defined(WIN32) || defined(CMINETFLATBUF))
-   S32           ret;            /* temporary return value */
-   uint32_t           pendLen;        /* pending data length */
-   S32           recvLen;        /* number of received octets by recvmsg() */
-   MsgLen        bufLen;         /* entire number of received octets */
-   MsgLen        curLen;         /* current number of octets in buffer */ 
-   Data         *recvBuf;        /* receive buffer */
-   Data         *bufPtr;         /* current buffer position */   
-   Buffer       *mBuf;           /* received message */ 
-   uint32_t           remAddrLen;     /* length of remote address */
-   struct sockaddr_in  *remAddr;    /* remote Internet address */       
+   S32          ret = 0;            /* temporary return value */
+   uint32_t     pendLen =0;        /* pending data length */
+   S32          recvLen =0;        /* number of received octets by recvmsg() */
+   MsgLen       bufLen =0;         /* entire number of received octets */
+   MsgLen       curLen =0;         /* current number of octets in buffer */ 
+   Data         *recvBuf =NULLP;        /* receive buffer */
+   Data         *bufPtr =NULLP;         /* current buffer position */   
+   Buffer       *mBuf = NULLP;           /* received message */ 
+   uint32_t     remAddrLen =0;     /* length of remote address */
+   struct sockaddr_in  *remAddr = {0};    /* remote Internet address */       
 #ifdef IPV6_SUPPORTED 
-   struct sockaddr_in6  *remAddr6;  /* remote Internet address */       
-   struct sockaddr_in6 remSockAddr; /* to get packet's source IP address */
+   struct sockaddr_in6  *remAddr6 = {0};  /* remote Internet address */       
+   struct sockaddr_in6 remSockAddr ={0}; /* to get packet's source IP address */
 #else
-   CmInetSockAddr  remSockAddr;     /* to get packet's source IP address */
+   CmInetSockAddr  remSockAddr ={0};     /* to get packet's source IP address */
 #endif /* IPV6_SUPPORTED */
 #else
-   S32           ret;            /* temporary return value */
+   S32           ret =0;            /* temporary return value */
   /* cm_inet_c_001.main_58: Fix for g++ compilation warning */
-   uint16_t           i;              /* index */
-   uint32_t           pendLen;        /* pending data length */
-   S32           numBuf;         /* number of allocated dBufs */
-   S32           recvLen;        /* number of received octets by recvmsg() */
-   MsgLen        bufLen;         /* entire number of received octets */
-   struct msghdr msg;            /* message header */ 
+   uint16_t      i =0;              /* index */
+   uint32_t      pendLen =0;        /* pending data length */
+   S32           numBuf =0;         /* number of allocated dBufs */
+   S32           recvLen =0;        /* number of received octets by recvmsg() */
+   MsgLen        bufLen =0;         /* entire number of received octets */
+   struct msghdr msg = {0};            /* message header */ 
    /* cm_inet_c_001.main_54: Fix for Klockworks issue */
    Buffer       *tempMsg = NULLP;        /* temporary message */
-   CmInetIovec  rxArr[CM_INET_MAX_DBUF]; /* dynamic gather array */
+   CmInetIovec  rxArr[CM_INET_MAX_DBUF]= {0};  /* dynamic gather array */
    Buffer      **dBufs = NULLP;   /* dynamic array with allocated dBufs */
-   S16           numDBufs;       /* number of allocated dBufs */
+   S16           numDBufs =0;       /* number of allocated dBufs */
 
    /* cm_inet_c_001.main_55: As remAddrLen is only being used when
     * WIN32 or CMINETFLATBUF is defined, then Removed variable
     * in else part*/
-   struct sockaddr_in *remAddr;  /* remote Internet address */       
+   struct sockaddr_in *remAddr = {0};  /* remote Internet address */       
 #ifdef IPV6_SUPPORTED 
-   struct sockaddr_in6 *remAddr6;  /* remote Internet address */       
-   struct sockaddr_in6 remSockAddr;/* to get packet's source IP address */
+   struct sockaddr_in6 *remAddr6 ={0};  /* remote Internet address */       
+   struct sockaddr_in6 remSockAddr ={0};/* to get packet's source IP address */
    /* added for IPv6 ext headers support */
 #ifdef IPV6_OPTS_SUPPORTED
-   CmInetIpv6RtHdr0     rtHdr0;          /* type 0 route header */      
+   CmInetIpv6RtHdr0     rtHdr0 ={0};          /* type 0 route header */      
 #endif /* IPV6_OPTS_SUPPORTED */
 
 #ifdef LOCAL_INTF
-   struct in6_pktinfo  *pkt6Info;        /* IPv6 IP_PKTINFO */
+   struct in6_pktinfo  *pkt6Info = {0};        /* IPv6 IP_PKTINFO */
 #endif /* LOCAL_INTF */   
 
 #if (defined(SS_LINUX) || defined(_XPG4_2))
@@ -5752,7 +5751,7 @@ S32              flags          /* additional control flags */
    /* from stack for IPv6 ancill data */
 #endif
 #else
-   CmInetSockAddr       remSockAddr;     /* to get packet's src IP address */
+   CmInetSockAddr       remSockAddr ={0};     /* to get packet's src IP address */
 #if (defined(SS_LINUX) || defined(_XPG4_2))
    uint8_t                   ancillData[CM_INET_IPV4_ANCIL_DATA];
    /* from stack for IPv4 ancill data */
index 2dd3256..ac6b699 100644 (file)
@@ -355,7 +355,7 @@ S16 cmStrcmp(const uint8_t *s1,const uint8_t *s2)
 {
    /*cm_lib_c_001.main_14 : Fix for TRACE5 feature crash due to missing TRC MACRO*/
 #if (STRCMP_AVAIL)
-   return (strcmp((const S8 *)s1, (const S8 *)s2));
+   return (strcmp((const char *)s1, (const char *)s2));
 #else   /* STRCMP_AVAIL */
   
    while (*s1 && *s2)
@@ -414,7 +414,7 @@ MsgLen       len /* cm_lib_c_001.main_12: Changing from S16 to MsgLen.*/
 {
    /*cm_lib_c_001.main_14 : Fix for TRACE5 feature crash due to missing TRC MACRO*/
 #if (STRNCMP_AVAIL)
-   return (strncmp((const S8 *)s1, (const S8 *)s2, (size_t) len));
+   return (strncmp((const char *)s1, (const char *)s2, (size_t) len));
 #else   /* STRNCMP_AVAIL */
   
    while (*s1 && *s2 && len--)
@@ -456,7 +456,7 @@ MsgLen cmStrlen(const uint8_t *s)
 {
 #if (STRLEN_AVAIL)
    /*cm_lib_c_001.main_15 : Fix for warning due to mixed declation*/
-   return ((MsgLen)strlen((const S8 *)s));
+   return ((MsgLen)strlen((const char *)s));
 #else   /* STRLEN_AVAIL */
    MsgLen i;
   
index 1b256b4..104e5b1 100644 (file)
@@ -2491,7 +2491,7 @@ void FreeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
                  if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
                        !=NULLP)
                  {
-                    CU_ALLOC(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\
+                    CU_FREE(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\
                           gTP_TEID.buf,ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.\
                           gTPTunnel->gTP_TEID.size);
                  }
@@ -2695,7 +2695,7 @@ void FreeUeContextSetupReq(F1AP_PDU_t  *f1apMsg)
                      case ProtocolIE_ID_id_RRCContainer:
                        if(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf != NULLP)
                        {
-                         CU_ALLOC(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, \
+                         CU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, \
                          ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
                        }
                        break;
index fc0695b..cbb092b 100644 (file)
@@ -142,7 +142,7 @@ void duProcGnbDuCfgUpdAckMsg()
 * ****************************************************************/
 uint8_t duGetCellCb(uint16_t cellId, DuCellCb **cellCb)
 {
-   uint8_t cellIdx;
+   uint8_t cellIdx = 0;
    for(cellIdx=0; cellIdx<duCb.numActvCells; cellIdx++)
    {
       if(duCb.actvCellLst[cellIdx]->cellId == cellId)
index d8f98ba..a25c8d8 100644 (file)
@@ -69,22 +69,22 @@ uint8_t BuildGlobalgNBId(GlobalE2node_gNB_ID_t *gNbId)
    else
    {
       buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
-         gNbId->global_gNB_ID.plmn_id.buf);
+           gNbId->global_gNB_ID.plmn_id.buf);
       /* fill gND Id */
       gNbId->global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
       /* Allocate Buffer size */
       gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size = byteSize * sizeof(uint8_t);
       gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf = NULLP;
       DU_ALLOC(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf, \
-         gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
+           gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
       if(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf == NULLP)
       {
-         DU_LOG("\nE2AP: Memory allocation failed for gnb buffer");
-         ret = RFAILED;
+        DU_LOG("\nE2AP: Memory allocation failed for gnb buffer");
+        ret = RFAILED;
       }
       else
       {
-         fillBitString(&gNbId->global_gNB_ID.gnb_id.choice.gnb_ID, unused, byteSize, val);
+        fillBitString(&gNbId->global_gNB_ID.gnb_id.choice.gnb_ID, unused, byteSize, val);
       }
    }
    return ret;
@@ -119,67 +119,67 @@ uint8_t fillE2SetupReq(E2setupRequest_t **e2SetupReq, uint8_t *idx)
       elementCnt = 1;
       (*e2SetupReq)->protocolIEs.list.count = elementCnt;
       (*e2SetupReq)->protocolIEs.list.size = \
-              elementCnt * sizeof(E2setupRequestIEs_t);
+                                            elementCnt * sizeof(E2setupRequestIEs_t);
 
       /* Initialize the E2Setup members */
       DU_ALLOC((*e2SetupReq)->protocolIEs.list.array, \
-               (*e2SetupReq)->protocolIEs.list.size);
+           (*e2SetupReq)->protocolIEs.list.size);
       if((*e2SetupReq)->protocolIEs.list.array == NULLP)
       {
-         DU_LOG("\nE2AP : Memory allocation failed for array elements");
-         ret = RFAILED;
+        DU_LOG("\nE2AP : Memory allocation failed for array elements");
+        ret = RFAILED;
       }
       else
       {
-         for(*idx = 0; *idx < elementCnt; (*idx)++)
-         {
-            DU_ALLOC((*e2SetupReq)->protocolIEs.list.array[*idx],\
-               sizeof(E2setupRequestIEs_t));
-            if((*e2SetupReq)->protocolIEs.list.array[*idx] == NULLP)
-            {
-               DU_LOG("\nE2AP : Memory allocation failed for arrayidx [%d]", *idx);
-               ret = RFAILED;
-            }
-            else
-            {
-               /* GlobalE2node_gNB_ID */
-               (*e2SetupReq)->protocolIEs.list.array[idx2]->id = \
-                      ProtocolIE_IDE2_id_GlobalE2node_ID;
-               (*e2SetupReq)->protocolIEs.list.array[idx2]->criticality = \
-                            CriticalityE2_reject;
-               (*e2SetupReq)->protocolIEs.list.array[idx2]->value.present =\
-                             E2setupRequestIEs__value_PR_GlobalE2node_ID;
-               (*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
-                  GlobalE2node_ID.present = GlobalE2node_ID_PR_gNB;
-      
-               DU_ALLOC((*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
-                  GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
-               if((*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
-                  GlobalE2node_ID.choice.gNB == NULLP)
-               {
-                  DU_LOG("\nE2AP : Memory allocation failed for gNbId");
-                  ret = RFAILED;
-               }
-               else
-               {
-                  ret = BuildGlobalgNBId((*e2SetupReq)->protocolIEs.list.array[idx2]->value.\
-                     choice.GlobalE2node_ID.choice.gNB);
-                  if(ret != ROK)
-                  {
-                     ret = RFAILED;
-                  }
-               }
-
-            }
-         }
+        for(*idx = 0; *idx < elementCnt; (*idx)++)
+        {
+           DU_ALLOC((*e2SetupReq)->protocolIEs.list.array[*idx],\
+                 sizeof(E2setupRequestIEs_t));
+           if((*e2SetupReq)->protocolIEs.list.array[*idx] == NULLP)
+           {
+              DU_LOG("\nE2AP : Memory allocation failed for arrayidx [%d]", *idx);
+              ret = RFAILED;
+           }
+           else
+           {
+              /* GlobalE2node_gNB_ID */
+              (*e2SetupReq)->protocolIEs.list.array[idx2]->id = \
+                                                                ProtocolIE_IDE2_id_GlobalE2node_ID;
+              (*e2SetupReq)->protocolIEs.list.array[idx2]->criticality = \
+                                                                         CriticalityE2_reject;
+              (*e2SetupReq)->protocolIEs.list.array[idx2]->value.present =\
+                                                                          E2setupRequestIEs__value_PR_GlobalE2node_ID;
+              (*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
+                 GlobalE2node_ID.present = GlobalE2node_ID_PR_gNB;
+
+              DU_ALLOC((*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
+                    GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
+              if((*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
+                    GlobalE2node_ID.choice.gNB == NULLP)
+              {
+                 DU_LOG("\nE2AP : Memory allocation failed for gNbId");
+                 ret = RFAILED;
+              }
+              else
+              {
+                 ret = BuildGlobalgNBId((*e2SetupReq)->protocolIEs.list.array[idx2]->value.\
+                       choice.GlobalE2node_ID.choice.gNB);
+                 if(ret != ROK)
+                 {
+                    ret = RFAILED;
+                 }
+              }
+
+           }
+        }
       }
-    }
-    else
-    {
-       ret = RFAILED;
-       DU_LOG("\nE2AP : Passed e2SetupReq is NULL");
-    }
-    return ret;
+   }
+   else
+   {
+      ret = RFAILED;
+      DU_LOG("\nE2AP : Passed e2SetupReq is NULL");
+   }
+   return ret;
 }
 
 /*******************************************************************
@@ -211,27 +211,27 @@ uint8_t BuildAndSendE2SetupReq()
       DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
       if(e2apMsg == NULLP)
       {
-         DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
-         break;
+        DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
+        break;
       }
       e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
       DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
       if(e2apMsg->choice.initiatingMessage == NULLP)
       {
-         DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
-         DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
-         return RFAILED;
+        DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
+        DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
+        return RFAILED;
       }
       e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
       e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_E2setup;
       e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_E2setupRequest;
       e2SetupReq = &e2apMsg->choice.initiatingMessage->value.choice.E2setupRequest;
-      
+
       ret = fillE2SetupReq(&e2SetupReq, &idx);
       if(ret != ROK)
       {
-         DU_LOG("\nE2AP : fillE2SetupReq() failed");
-         break;
+        DU_LOG("\nE2AP : fillE2SetupReq() failed");
+        break;
       }
       /* Prints the Msg formed */
       xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg);
@@ -239,27 +239,27 @@ uint8_t BuildAndSendE2SetupReq()
       memset(encBuf, 0, ENC_BUF_MAX_LEN);
       encBufSize = 0;
       encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf,\
-                      encBuf);
+           encBuf);
       if(encRetVal.encoded == ENCODE_FAIL)
       {
-         DU_LOG("\nE2AP : Could not encode E2SetupRequest structure (at %s)\n",\
-            encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-         break;
+        DU_LOG("\nE2AP : Could not encode E2SetupRequest structure (at %s)\n",\
+              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+        break;
       }
       else
       {
-         DU_LOG("\nE2AP : Created APER encoded buffer for E2SetupRequest\n");
-         for(int i=0; i< encBufSize; i++)
-         {
-            printf("%x",encBuf[i]);
-         }
+        DU_LOG("\nE2AP : Created APER encoded buffer for E2SetupRequest\n");
+        for(int i=0; i< encBufSize; i++)
+        {
+           printf("%x",encBuf[i]);
+        }
       }
       if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
       {
-         DU_LOG("\nE2AP : Sending E2 Setup request failed");
+        DU_LOG("\nE2AP : Sending E2 Setup request failed");
       }
 
-    break;
+      break;
    }while(true);
 
    deAllocateE2SetupReqMsg(e2apMsg, e2SetupReq, idx);
@@ -284,7 +284,7 @@ uint8_t BuildAndSendE2SetupReq()
  * ****************************************************************/
 
 uint8_t deAllocateE2SetupReqMsg(E2AP_PDU_t *e2apMsg, \
-   E2setupRequest_t *e2SetupReq, uint8_t idx)
+      E2setupRequest_t *e2SetupReq, uint8_t idx)
 {
    uint8_t idx2;
    uint8_t ret = ROK;
@@ -293,49 +293,49 @@ uint8_t deAllocateE2SetupReqMsg(E2AP_PDU_t *e2apMsg, \
    {
       if(e2apMsg->choice.initiatingMessage != NULLP)
       {
-         if(e2SetupReq->protocolIEs.list.array != NULLP)
-         {
-            for(idx2 = 0; idx2 < idx; idx2++)
-            {
-               if(e2SetupReq->protocolIEs.list.array[idx2] != NULLP)
-               {
-                  switch(e2SetupReq->protocolIEs.list.array[idx2]->id)
-                  {
-                     case ProtocolIE_IDE2_id_GlobalE2node_ID:
-                     {
-                        if(e2SetupReq->protocolIEs.list.array[idx2]->\
-                             value.choice.GlobalE2node_ID.choice.gNB != NULLP)
-                        {
-                              GlobalE2node_gNB_ID_t *gNbId = NULLP;
-                              gNbId = e2SetupReq->protocolIEs.list.array[idx2]->\
-                                         value.choice.GlobalE2node_ID.choice.gNB;
-                              if(gNbId->global_gNB_ID.plmn_id.buf != NULLP)
-                              {
-                                 if(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf != NULLP)
-                                 {
-                                    DU_FREE(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf,\
-                                       gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
-                                 }
-                                 DU_FREE(gNbId->global_gNB_ID.plmn_id.buf,\
-                                            gNbId->global_gNB_ID.plmn_id.size);
-                              }
-                              DU_FREE(e2SetupReq->protocolIEs.list.array[idx2]->value.\
-                                choice.GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
-                        }
-                        DU_FREE(e2SetupReq->protocolIEs.list.array[idx2],\
-                            sizeof(E2setupRequestIEs_t));
-                        break;
-                     }
-                     default:
-                        DU_LOG("\n E2AP: Invalid event at e2SetupRequet %ld ",\
-                          (e2SetupReq->protocolIEs.list.array[idx2]->id));
-                        break;
-                  }
-               }
-            }
-            DU_FREE(e2SetupReq->protocolIEs.list.array, e2SetupReq->protocolIEs.list.size);
-         }
-         DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+        if(e2SetupReq->protocolIEs.list.array != NULLP)
+        {
+           for(idx2 = 0; idx2 < idx; idx2++)
+           {
+              if(e2SetupReq->protocolIEs.list.array[idx2] != NULLP)
+              {
+                 switch(e2SetupReq->protocolIEs.list.array[idx2]->id)
+                 {
+                    case ProtocolIE_IDE2_id_GlobalE2node_ID:
+                       {
+                          if(e2SetupReq->protocolIEs.list.array[idx2]->\
+                                value.choice.GlobalE2node_ID.choice.gNB != NULLP)
+                          {
+                             GlobalE2node_gNB_ID_t *gNbId = NULLP;
+                             gNbId = e2SetupReq->protocolIEs.list.array[idx2]->\
+                                     value.choice.GlobalE2node_ID.choice.gNB;
+                             if(gNbId->global_gNB_ID.plmn_id.buf != NULLP)
+                             {
+                                if(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf != NULLP)
+                                {
+                                   DU_FREE(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf,\
+                                         gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
+                                }
+                                DU_FREE(gNbId->global_gNB_ID.plmn_id.buf,\
+                                      gNbId->global_gNB_ID.plmn_id.size);
+                             }
+                             DU_FREE(e2SetupReq->protocolIEs.list.array[idx2]->value.\
+                                   choice.GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
+                          }
+                          DU_FREE(e2SetupReq->protocolIEs.list.array[idx2],\
+                                sizeof(E2setupRequestIEs_t));
+                          break;
+                       }
+                    default:
+                       DU_LOG("\n E2AP: Invalid event at e2SetupRequet %ld ",\
+                             (e2SetupReq->protocolIEs.list.array[idx2]->id));
+                       break;
+                 }
+              }
+           }
+           DU_FREE(e2SetupReq->protocolIEs.list.array, e2SetupReq->protocolIEs.list.size);
+        }
+        DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
       }
       DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
    }
@@ -359,15 +359,13 @@ uint8_t deAllocateE2SetupReqMsg(E2AP_PDU_t *e2apMsg, \
 
 uint8_t BuildRicRequestId(RICrequestID_t *ricReqId)
 {
-   if(ricReqId != NULLP)
+   if(ricReqId == NULLP)
    {
-      ricReqId->ricRequestorID = 1;
-      ricReqId->ricInstanceID  = 1;
+      return RFAILED;
    }
-       else
-       {
-          return RFAILED;
-       }
+
+   ricReqId->ricRequestorID = 1;
+   ricReqId->ricInstanceID  = 1;
    return ROK;
 }
 
@@ -397,10 +395,10 @@ uint8_t fillRicAdmitList(RICaction_Admitted_ItemIEs_t *ricAdmitItems)
       ricAdmitItems->value.present = RICaction_Admitted_ItemIEs__value_PR_RICaction_Admitted_Item;
       ricAdmitItems->value.choice.RICaction_Admitted_Item.ricActionID = 1; 
    }
-       else
-       {
-          return RFAILED;
-       }
+   else
+   {
+      return RFAILED;
+   }
    return ROK;
 }
 /*******************************************************************
@@ -423,41 +421,41 @@ uint8_t BuildRicAdmitList(RICaction_Admitted_List_t *admitListPtr)
 {
    uint8_t idx ;
    uint8_t elementCnt;  
-       uint8_t ret= ROK;
+   uint8_t ret= ROK;
    elementCnt = 1;
 
    if(admitListPtr == NULLP)
-       {
-           DU_LOG("\nE2AP : Memory allocation for RIC Admit List failed");
-           ret = RFAILED;
-       }
+   {
+      DU_LOG("\nE2AP : Memory allocation for RIC Admit List failed");
+      ret = RFAILED;
+   }
    else
-       {
-          admitListPtr->list.count = elementCnt;
+   {
+      admitListPtr->list.count = elementCnt;
       admitListPtr->list.size  = elementCnt * sizeof(RICaction_Admitted_ItemIEs_t);
       DU_ALLOC(admitListPtr->list.array, admitListPtr->list.size);
       if(admitListPtr->list.array == NULLP)
       {
-         DU_LOG("\nE2AP : Memory allocation for RIC Admit List failed");
-         ret = RFAILED;
+        DU_LOG("\nE2AP : Memory allocation for RIC Admit List failed");
+        ret = RFAILED;
       }
-               else
-               {
-             for(idx=0 ; idx<elementCnt ; idx++ )
-             {
-            DU_ALLOC(admitListPtr->list.array[idx], sizeof(RICaction_Admitted_ItemIEs_t));
-                     if(admitListPtr->list.array[idx] == NULLP)
-                     {
-                        ret = RFAILED;
-                     }
-                       }
-                       if(ret != RFAILED)
-                       {
-                idx=0;
-            fillRicAdmitList((RICaction_Admitted_ItemIEs_t *)admitListPtr->list.array[idx]);
-         }
-               }
-       }       
+      else
+      {
+        for(idx=0 ; idx<elementCnt ; idx++ )
+        {
+           DU_ALLOC(admitListPtr->list.array[idx], sizeof(RICaction_Admitted_ItemIEs_t));
+           if(admitListPtr->list.array[idx] == NULLP)
+           {
+              ret = RFAILED;
+           }
+        }
+        if(ret != RFAILED)
+        {
+           idx=0;
+           fillRicAdmitList((RICaction_Admitted_ItemIEs_t *)admitListPtr->list.array[idx]);
+        }
+      }
+   }   
    return ret;
 }
 /*******************************************************************
@@ -478,67 +476,67 @@ uint8_t BuildRicAdmitList(RICaction_Admitted_List_t *admitListPtr)
  ******************************************************************/
 void FreeRicSubscriptionRsp(E2AP_PDU_t  *e2apRicMsg)
 {
-         RICsubscriptionResponse_t  *ricSubscriptionRsp= NULLP;
-     uint8_t idx=0;
-         uint8_t idx1=0;
-         RICaction_Admitted_List_t *admitListPtr;
-
-         if(e2apRicMsg != NULLP)
-         {
-            if(e2apRicMsg->choice.successfulOutcome != NULLP)
+   RICsubscriptionResponse_t  *ricSubscriptionRsp= NULLP;
+   uint8_t idx=0;
+   uint8_t idx1=0;
+   RICaction_Admitted_List_t *admitListPtr;
+
+   if(e2apRicMsg != NULLP)
+   {
+      if(e2apRicMsg->choice.successfulOutcome != NULLP)
+      {
+        ricSubscriptionRsp = &e2apRicMsg->choice.successfulOutcome->value.choice.RICsubscriptionResponse;
+        if(ricSubscriptionRsp)
+        {
+           if(ricSubscriptionRsp->protocolIEs.list.array != NULLP)
+           {
+              for(idx=0; idx<ricSubscriptionRsp->protocolIEs.list.count; idx++)
+              {
+                 if(ricSubscriptionRsp->protocolIEs.list.array[idx] != NULLP)
                  {
-                    ricSubscriptionRsp = &e2apRicMsg->choice.successfulOutcome->value.choice.RICsubscriptionResponse;
-                         if(ricSubscriptionRsp)
-                         {
-                            if(ricSubscriptionRsp->protocolIEs.list.array != NULLP)
-                                 {
-                                    for(idx=0; idx<ricSubscriptionRsp->protocolIEs.list.count; idx++)
-                                         {
-                                            if(ricSubscriptionRsp->protocolIEs.list.array[idx] != NULLP)
-                                                 {
-                                                    switch(ricSubscriptionRsp->protocolIEs.list.array[idx]->id)
-                                                         {
-                                                            case ProtocolIE_IDE2_id_RICrequestID:
-                                                                      break;
-
-                                                                 case ProtocolIE_IDE2_id_RANfunctionID:
-                                                                      break;
-
-                                                                 case ProtocolIE_IDE2_id_RICactions_Admitted:
-                                                       {
-                                                           admitListPtr = &ricSubscriptionRsp->protocolIEs.list.\
-                                                                          array[idx]->value.choice.RICaction_Admitted_List;
-                                                                          if(admitListPtr->list.array != NULLP)
-                                                                          {
-                                                                              for(idx1=0 ; idx1<admitListPtr->list.count; idx1++ )
-                                                                              {
-                                                                                 if(admitListPtr->list.array[idx1] != NULLP)
-                                                                  {
-                                                                                        DU_FREE(admitListPtr->list.array[idx1],
-                                                                                    sizeof(RICaction_Admitted_ItemIEs_t));
-                                                                                           }
-                                                                              }
-                                                                                   DU_FREE(admitListPtr->list.array, admitListPtr->list.size);  
-                               }
-                                                                                break;
-                                                                   }
-                                                                        default:
-                                                                           break;
-                        }
-                                                     DU_FREE(ricSubscriptionRsp->protocolIEs.list.array[idx], \
-                                                          sizeof(RICsubscriptionResponse_IEs_t));
-                                                  }
-                                          }
-                                          DU_FREE(ricSubscriptionRsp->protocolIEs.list.array, \
-                                          ricSubscriptionRsp->protocolIEs.list.size);
-               }
-            }   
-                          DU_FREE(e2apRicMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
-                  }            
-         DU_FREE(e2apRicMsg, sizeof(E2AP_PDU_t));            
-         }
+                    switch(ricSubscriptionRsp->protocolIEs.list.array[idx]->id)
+                    {
+                       case ProtocolIE_IDE2_id_RICrequestID:
+                          break;
+
+                       case ProtocolIE_IDE2_id_RANfunctionID:
+                          break;
+
+                       case ProtocolIE_IDE2_id_RICactions_Admitted:
+                          {
+                             admitListPtr = &ricSubscriptionRsp->protocolIEs.list.\
+                                            array[idx]->value.choice.RICaction_Admitted_List;
+                             if(admitListPtr->list.array != NULLP)
+                             {
+                                for(idx1=0 ; idx1<admitListPtr->list.count; idx1++ )
+                                {
+                                   if(admitListPtr->list.array[idx1] != NULLP)
+                                   {
+                                      DU_FREE(admitListPtr->list.array[idx1],
+                                            sizeof(RICaction_Admitted_ItemIEs_t));
+                                   }
+                                }
+                                DU_FREE(admitListPtr->list.array, admitListPtr->list.size);     
+                             }
+                             break;
+                          }
+                       default:
+                          break;
+                    }
+                    DU_FREE(ricSubscriptionRsp->protocolIEs.list.array[idx], \
+                          sizeof(RICsubscriptionResponse_IEs_t));
+                 }
+              }
+              DU_FREE(ricSubscriptionRsp->protocolIEs.list.array, \
+                    ricSubscriptionRsp->protocolIEs.list.size);
+           }
+        }   
+        DU_FREE(e2apRicMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
+      }                
+      DU_FREE(e2apRicMsg, sizeof(E2AP_PDU_t));       
+   }
 }
- /*******************************************************************
+/*******************************************************************
  *
  * @brief Builds and Send the RicSubscriptionRsp
  *
@@ -555,69 +553,69 @@ void FreeRicSubscriptionRsp(E2AP_PDU_t  *e2apRicMsg)
 uint8_t  FillRicSubscriptionRsp(RICsubscriptionResponse_t  *ricSubscriptionRsp )
 {
    uint8_t idx=0;
-       uint8_t ret = ROK;
-       uint8_t elementCnt = 0;
-       uint8_t BuildRicRequestIdret=ROK;
-       uint8_t BuildRicAdmitListret=ROK;
+   uint8_t ret = ROK;
+   uint8_t elementCnt = 0;
+   uint8_t BuildRicRequestIdret=ROK;
+   uint8_t BuildRicAdmitListret=ROK;
 
    elementCnt=3;
-       ricSubscriptionRsp->protocolIEs.list.count = elementCnt;
-       ricSubscriptionRsp->protocolIEs.list.size  = elementCnt * sizeof(RICsubscriptionResponse_IEs_t);
+   ricSubscriptionRsp->protocolIEs.list.count = elementCnt;
+   ricSubscriptionRsp->protocolIEs.list.size  = elementCnt * sizeof(RICsubscriptionResponse_IEs_t);
    DU_ALLOC(ricSubscriptionRsp->protocolIEs.list.array, \
-       ricSubscriptionRsp->protocolIEs.list.size);
-       if(ricSubscriptionRsp->protocolIEs.list.array == NULLP)
-       {
+        ricSubscriptionRsp->protocolIEs.list.size);
+   if(ricSubscriptionRsp->protocolIEs.list.array == NULLP)
+   {
       DU_LOG("\nE2AP : Memory allocation for FillRicSubscriptionRsp  failed");
-               ret = RFAILED;
-       }
-       else
-       {
-          for(idx=0; idx<ricSubscriptionRsp->protocolIEs.list.count; idx++)
-          {
-             DU_ALLOC(ricSubscriptionRsp->protocolIEs.list.array[idx], \
-               sizeof(RICsubscriptionResponse_IEs_t));
-               if(ricSubscriptionRsp->protocolIEs.list.array[idx] == NULLP)
-                       {
-                       ret = RFAILED;
-                       }
-               }
-               if(ret != RFAILED)
-               {
-          
-                       idx=0;
-               ricSubscriptionRsp->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICrequestID;
-               ricSubscriptionRsp->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
-               ricSubscriptionRsp->protocolIEs.list.array[idx]->value.present =\
-               RICsubscriptionRequest_IEs__value_PR_RICrequestID;
-               BuildRicRequestIdret =
-               BuildRicRequestId(&ricSubscriptionRsp->protocolIEs.list.array[idx]->value.choice.RICrequestID);
-               if(BuildRicRequestIdret != ROK)
-               {
-                       ret = RFAILED;
-               }
-             else
-                       {
-                               idx++;
-                               ricSubscriptionRsp->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RANfunctionID;
-                               ricSubscriptionRsp->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
-                               ricSubscriptionRsp->protocolIEs.list.array[idx]->value.present =\
-                               RICsubscriptionRequest_IEs__value_PR_RANfunctionID;
-                               ricSubscriptionRsp->protocolIEs.list.array[idx]->value.choice.RANfunctionID = 1;
-       
-                               idx++;
-                               ricSubscriptionRsp->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICactions_Admitted;
-                               ricSubscriptionRsp->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
-                               ricSubscriptionRsp->protocolIEs.list.array[idx]->value.present =\
-                               RICsubscriptionResponse_IEs__value_PR_RICaction_Admitted_List;
-                               BuildRicAdmitListret =
-                               BuildRicAdmitList(&ricSubscriptionRsp->protocolIEs.list.array[idx]->value.choice.RICaction_Admitted_List);
-                               if(BuildRicAdmitListret != ROK)
-                               {
-                               ret = RFAILED;
-                               }
-                       }
-               }
-       }       
+      ret = RFAILED;
+   }
+   else
+   {
+      for(idx=0; idx<ricSubscriptionRsp->protocolIEs.list.count; idx++)
+      {
+        DU_ALLOC(ricSubscriptionRsp->protocolIEs.list.array[idx], \
+              sizeof(RICsubscriptionResponse_IEs_t));
+        if(ricSubscriptionRsp->protocolIEs.list.array[idx] == NULLP)
+        {
+           ret = RFAILED;
+        }
+      }
+      if(ret != RFAILED)
+      {
+
+        idx=0;
+        ricSubscriptionRsp->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICrequestID;
+        ricSubscriptionRsp->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+        ricSubscriptionRsp->protocolIEs.list.array[idx]->value.present =\
+                                                                        RICsubscriptionRequest_IEs__value_PR_RICrequestID;
+        BuildRicRequestIdret =
+           BuildRicRequestId(&ricSubscriptionRsp->protocolIEs.list.array[idx]->value.choice.RICrequestID);
+        if(BuildRicRequestIdret != ROK)
+        {
+           ret = RFAILED;
+        }
+        else
+        {
+           idx++;
+           ricSubscriptionRsp->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RANfunctionID;
+           ricSubscriptionRsp->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+           ricSubscriptionRsp->protocolIEs.list.array[idx]->value.present =\
+                                                                           RICsubscriptionRequest_IEs__value_PR_RANfunctionID;
+           ricSubscriptionRsp->protocolIEs.list.array[idx]->value.choice.RANfunctionID = 1;
+
+           idx++;
+           ricSubscriptionRsp->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICactions_Admitted;
+           ricSubscriptionRsp->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+           ricSubscriptionRsp->protocolIEs.list.array[idx]->value.present =\
+                                                                           RICsubscriptionResponse_IEs__value_PR_RICaction_Admitted_List;
+           BuildRicAdmitListret =
+              BuildRicAdmitList(&ricSubscriptionRsp->protocolIEs.list.array[idx]->value.choice.RICaction_Admitted_List);
+           if(BuildRicAdmitListret != ROK)
+           {
+              ret = RFAILED;
+           }
+        }
+      }
+   }   
    return ret;
 }
 /*******************************************************************
@@ -643,89 +641,89 @@ uint8_t BuildAndSendRicSubscriptionRsp()
    asn_enc_rval_t     encRetVal; 
    uint8_t ret = RFAILED;
    uint8_t FillRicricSubscriptionRspret;
-       
+
    while(true)
    {
-        DU_LOG("\nE2AP : Building RIC Subscription Response\n");
-
-        DU_ALLOC(e2apRicMsg, sizeof(E2AP_PDU_t)); 
-        if(e2apRicMsg == NULLP)
-        {
-           DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
-           break;
-        }
-        e2apRicMsg->present =  E2AP_PDU_PR_successfulOutcome;
-        DU_ALLOC(e2apRicMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
-        if(e2apRicMsg->choice.successfulOutcome == NULLP)
-        {
-             DU_LOG("\nE2AP : Memory allocation for Ric subscription Response failed");
-             break;
-        }
-
-        e2apRicMsg->choice.successfulOutcome->procedureCode = ProcedureCodeE2_id_RICsubscription;
-        e2apRicMsg->choice.successfulOutcome->criticality = CriticalityE2_reject;
-        e2apRicMsg->choice.successfulOutcome->value.present = \
-         SuccessfulOutcomeE2__value_PR_RICsubscriptionResponse;
-        ricSubscriptionRsp = &e2apRicMsg->choice.successfulOutcome->value.choice.RICsubscriptionResponse;
-
-                 FillRicricSubscriptionRspret = FillRicSubscriptionRsp(ricSubscriptionRsp);
-        if(FillRicricSubscriptionRspret != ROK)
-                 {
-                    DU_LOG("\nE2AP : Memory allocation for RICsubscriptionResponseIE failed");
-                    break;
-                 }
+      DU_LOG("\nE2AP : Building RIC Subscription Response\n");
 
-       /* Prints the Msg formed */
-        xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apRicMsg);
-
-        memset(encBuf, 0, ENC_BUF_MAX_LEN);
-        encBufSize = 0;
-        encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apRicMsg, PrepFinalEncBuf,\
-               encBuf);
-        if(encRetVal.encoded == ENCODE_FAIL)
-        {
-                DU_LOG("\nE2AP : Could not encode RIC Subscription Response structure (at %s)\n",\
-                          encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-                break;
-        }
-        else
-        {
-            DU_LOG("\nE2AP : Created APER encoded buffer for RIC subscription response \n");
-                for(int i=0; i< encBufSize; i++)
-                {
-                         printf("%x",encBuf[i]);
-                } 
-        } 
-
-        if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
-        {
-            DU_LOG("\nE2AP : Sending RIC Subscription Response failed");      
-            break;
-        }
-
-                 ret = ROK;
-                 break;
+      DU_ALLOC(e2apRicMsg, sizeof(E2AP_PDU_t)); 
+      if(e2apRicMsg == NULLP)
+      {
+        DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
+        break;
+      }
+      e2apRicMsg->present =  E2AP_PDU_PR_successfulOutcome;
+      DU_ALLOC(e2apRicMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
+      if(e2apRicMsg->choice.successfulOutcome == NULLP)
+      {
+        DU_LOG("\nE2AP : Memory allocation for Ric subscription Response failed");
+        break;
+      }
+
+      e2apRicMsg->choice.successfulOutcome->procedureCode = ProcedureCodeE2_id_RICsubscription;
+      e2apRicMsg->choice.successfulOutcome->criticality = CriticalityE2_reject;
+      e2apRicMsg->choice.successfulOutcome->value.present = \
+                                                           SuccessfulOutcomeE2__value_PR_RICsubscriptionResponse;
+      ricSubscriptionRsp = &e2apRicMsg->choice.successfulOutcome->value.choice.RICsubscriptionResponse;
+
+      FillRicricSubscriptionRspret = FillRicSubscriptionRsp(ricSubscriptionRsp);
+      if(FillRicricSubscriptionRspret != ROK)
+      {
+        DU_LOG("\nE2AP : Memory allocation for RICsubscriptionResponseIE failed");
+        break;
+      }
+
+      /* Prints the Msg formed */
+      xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apRicMsg);
+
+      memset(encBuf, 0, ENC_BUF_MAX_LEN);
+      encBufSize = 0;
+      encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apRicMsg, PrepFinalEncBuf,\
+           encBuf);
+      if(encRetVal.encoded == ENCODE_FAIL)
+      {
+        DU_LOG("\nE2AP : Could not encode RIC Subscription Response structure (at %s)\n",\
+              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+        break;
+      }
+      else
+      {
+        DU_LOG("\nE2AP : Created APER encoded buffer for RIC subscription response \n");
+        for(int i=0; i< encBufSize; i++)
+        {
+           printf("%x",encBuf[i]);
+        } 
+      } 
 
-    }
-        FreeRicSubscriptionRsp(e2apRicMsg);
-    
-        return ret;
- }
+      if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+      {
+        DU_LOG("\nE2AP : Sending RIC Subscription Response failed");      
+        break;
+      }
+
+      ret = ROK;
+      break;
+
+   }
+   FreeRicSubscriptionRsp(e2apRicMsg);
+
+   return ret;
+}
 /******************************************************************
-*
-* @brief Processes E2 Setup Response sent by RIC
-*
-* @details
-*
-*    Function : procE2SetupRsp
-*
-*    Functionality: Processes E2 Setup Response sent by RIC
-*
-* @params[in] E2AP_PDU_t ASN decoded E2AP message
-* @return ROK     - success
-*         RFAILED - failure
-*
-* ****************************************************************/
+ *
+ * @brief Processes E2 Setup Response sent by RIC
+ *
+ * @details
+ *
+ *    Function : procE2SetupRsp
+ *
+ *    Functionality: Processes E2 Setup Response sent by RIC
+ *
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 uint8_t procE2SetupRsp(E2AP_PDU_t *e2apMsg)
 {
    uint8_t idx; 
@@ -740,46 +738,52 @@ uint8_t procE2SetupRsp(E2AP_PDU_t *e2apMsg)
    {
       switch(e2SetRspMsg->protocolIEs.list.array[idx]->id)
       {
-         case ProtocolIE_IDE2_id_GlobalRIC_ID:
-         {
-            /* To store the Ric Id Params */
-            recvBufLen = sizeof(e2SetRspMsg->protocolIEs.list.array[idx]->value\
-                                .choice.GlobalRIC_ID.pLMN_Identity.size);
-                               e2apMsgDb.plmn = NULLP;
-            DU_ALLOC(e2apMsgDb.plmn, recvBufLen);
-                               if(e2apMsgDb.plmn)
-                               {
-                                  memcpy(e2apMsgDb.plmn, e2SetRspMsg->protocolIEs.list.array[idx]\
-                                        ->value.choice.GlobalRIC_ID.pLMN_Identity.buf, recvBufLen);
-                               }
-            bitStringToInt(&e2SetRspMsg->protocolIEs.list.array[idx]->value.choice.GlobalRIC_ID.ric_ID, &e2apMsgDb.ricId);
-            /*TODO : e2apMsgDb.plmn memory to be deallocated after the usage */
-                          break;
-         }
-         default:
-            DU_LOG("\nE2AP : Invalid IE received in E2SetupRsp:%ld",
-                  e2SetRspMsg->protocolIEs.list.array[idx]->id);
-            break;
+        case ProtocolIE_IDE2_id_GlobalRIC_ID:
+           {
+              /* To store the Ric Id Params */
+              recvBufLen = sizeof(e2SetRspMsg->protocolIEs.list.array[idx]->value\
+                    .choice.GlobalRIC_ID.pLMN_Identity.size);
+              e2apMsgDb.plmn = NULLP;
+              DU_ALLOC(e2apMsgDb.plmn, recvBufLen);
+              if(e2apMsgDb.plmn)
+              {
+                 memcpy(e2apMsgDb.plmn, e2SetRspMsg->protocolIEs.list.array[idx]\
+                       ->value.choice.GlobalRIC_ID.pLMN_Identity.buf, recvBufLen);
+                 free(e2SetRspMsg->protocolIEs.list.array[idx]->value.choice.\
+                       GlobalRIC_ID.pLMN_Identity.buf);
+              }
+              bitStringToInt(&e2SetRspMsg->protocolIEs.list.array[idx]->value.choice.GlobalRIC_ID.ric_ID, &e2apMsgDb.ricId);
+              free(e2SetRspMsg->protocolIEs.list.array[idx]->value.choice.\
+                    GlobalRIC_ID.ric_ID.buf);
+              /*TODO : e2apMsgDb.plmn memory to be deallocated after the usage */
+              break;
+           }
+        default:
+           DU_LOG("\nE2AP : Invalid IE received in E2SetupRsp:%ld",
+                 e2SetRspMsg->protocolIEs.list.array[idx]->id);
+           break;
       }
+      free(e2SetRspMsg->protocolIEs.list.array[idx]);
    }
+   free(e2SetRspMsg->protocolIEs.list.array);
    return ROK;
 }
 
 /******************************************************************
-*
-* @brief Processes RIC Subscription Req sent by RIC
-*
-* @details
-*
-*    Function : procRicSubsReq
-*
-*    Functionality: Processes E2 Setup Response sent by CU
-*
-* @params[in] E2AP_PDU_t ASN decoded E2AP message
-* @return ROK     - success
-*         RFAILED - failure
-*
-* ****************************************************************/
+ *
+ * @brief Processes RIC Subscription Req sent by RIC
+ *
+ * @details
+ *
+ *    Function : procRicSubsReq
+ *
+ *    Functionality: Processes E2 Setup Response sent by CU
+ *
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 
 uint8_t procRicSubsReq(E2AP_PDU_t *e2apMsg)
 {
@@ -795,71 +799,84 @@ uint8_t procRicSubsReq(E2AP_PDU_t *e2apMsg)
 
    for(idx=0; idx<ricSubsReq->protocolIEs.list.count; idx++)
    {
-      switch(ricSubsReq->protocolIEs.list.array[idx]->id)
+      if(ricSubsReq->protocolIEs.list.array[idx])
       {
-         case ProtocolIE_IDE2_id_RICrequestID:
-         {
-            e2apMsgDb.ricReqId = ricSubsReq->protocolIEs.list.array[idx]->\
-                                   value.choice.RICrequestID.ricRequestorID;
-            e2apMsgDb.ricInstanceId = ricSubsReq->protocolIEs.list.array[idx]-> \
-                                       value.choice.RICrequestID.ricInstanceID;
-            break;
-         }
-         case ProtocolIE_IDE2_id_RANfunctionID:
-         {
-            e2apMsgDb.ranFuncId = ricSubsReq->protocolIEs.list.array[idx]-> \
-                                   value.choice.RANfunctionID; 
-            break;
-         }
-         case ProtocolIE_IDE2_id_RICsubscriptionDetails:
-         {
-                          recvBufLen = sizeof(ricSubsReq->protocolIEs.list.array[idx]->value\
-                                .choice.RICsubscriptionDetails.ricEventTriggerDefinition.size);
-                          e2apMsgDb.ricEventTrigger = NULLP;
-                               DU_ALLOC(e2apMsgDb.ricEventTrigger, recvBufLen);
-                               /*TODO : e2apMsgDb.ricEventTrigger memory to be deallocated after the usage */
-                               if(e2apMsgDb.ricEventTrigger)
-                               {
-                                  memcpy(e2apMsgDb.ricEventTrigger, ricSubsReq->protocolIEs.list.array[idx]\
-                                        ->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.buf, \
-                                        recvBufLen);
-                          }
-            actionItem =(RICaction_ToBeSetup_ItemIEs_t *)ricSubsReq->protocolIEs.list\
+        switch(ricSubsReq->protocolIEs.list.array[idx]->id)
+        {
+           case ProtocolIE_IDE2_id_RICrequestID:
+              {
+                 e2apMsgDb.ricReqId = ricSubsReq->protocolIEs.list.array[idx]->\
+                                      value.choice.RICrequestID.ricRequestorID;
+                 e2apMsgDb.ricInstanceId = ricSubsReq->protocolIEs.list.array[idx]-> \
+                                           value.choice.RICrequestID.ricInstanceID;
+                 break;
+              }
+           case ProtocolIE_IDE2_id_RANfunctionID:
+              {
+                 e2apMsgDb.ranFuncId = ricSubsReq->protocolIEs.list.array[idx]-> \
+                                       value.choice.RANfunctionID; 
+                 break;
+              }
+           case ProtocolIE_IDE2_id_RICsubscriptionDetails:
+              {
+                 recvBufLen = sizeof(ricSubsReq->protocolIEs.list.array[idx]->value\
+                       .choice.RICsubscriptionDetails.ricEventTriggerDefinition.size);
+                 e2apMsgDb.ricEventTrigger = NULLP;
+                 DU_ALLOC(e2apMsgDb.ricEventTrigger, recvBufLen);
+                 /*TODO : e2apMsgDb.ricEventTrigger memory to be deallocated after the usage */
+                 if(e2apMsgDb.ricEventTrigger)
+                 {
+                    memcpy(e2apMsgDb.ricEventTrigger, ricSubsReq->protocolIEs.list.array[idx]\
+                          ->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.buf, \
+                          recvBufLen);
+                    free(ricSubsReq->protocolIEs.list.array[idx]->value.choice.\
+                          RICsubscriptionDetails.ricEventTriggerDefinition.buf);
+                 }
+                 if(ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.\
+                       list.array)
+                 {
+                    actionItem =(RICaction_ToBeSetup_ItemIEs_t *)ricSubsReq->protocolIEs.list\
                                 .array[idx]->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List\
                                 .list.array[0];
-            
-            for(ied = 0; ied < ricSubsReq->protocolIEs.list.array[idx]->value.choice.\
-             RICsubscriptionDetails.ricAction_ToBeSetup_List.list.count; ied++)
-            {
-               switch(actionItem->id)
-               {
-                  case ProtocolIE_IDE2_id_RICaction_ToBeSetup_Item:
-                  {
-                     e2apMsgDb.ricActionId = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionID;
-                     e2apMsgDb.ricActionType = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionType;
-                     break;
-                  }
-                  default:
-                     DU_LOG("\nE2AP : Invalid IE received in RicSetupLst:%ld",actionItem->id);
-                  break;
-               }
-            }
-            break;
-         }
-
-         default:
-            DU_LOG("\nE2AP : Invalid IE received in Ric SubsReq:%ld",
-                  ricSubsReq->protocolIEs.list.array[idx]->id);
-            break;
+
+                    for(ied = 0; ied < ricSubsReq->protocolIEs.list.array[idx]->value.choice.\
+                          RICsubscriptionDetails.ricAction_ToBeSetup_List.list.count; ied++)
+                    {
+                       switch(actionItem->id)
+                       {
+                          case ProtocolIE_IDE2_id_RICaction_ToBeSetup_Item:
+                             {
+                                e2apMsgDb.ricActionId = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionID;
+                                e2apMsgDb.ricActionType = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionType;
+                                break;
+                             }
+                          default:
+                             DU_LOG("\nE2AP : Invalid IE received in RicSetupLst:%ld",actionItem->id);
+                             break;
+                       }
+                       free(actionItem);
+                    }
+                    free(ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.\
+                    list.array);
+                 }
+                 break;
+              }
+
+           default:
+              DU_LOG("\nE2AP : Invalid IE received in Ric SubsReq:%ld",
+                    ricSubsReq->protocolIEs.list.array[idx]->id);
+              break;
+        }
+        free(ricSubsReq->protocolIEs.list.array[idx]);
       }
    }
+   free(ricSubsReq->protocolIEs.list.array);
    ret = BuildAndSendRicSubscriptionRsp();
 
    return ret;
 }
 
- /*******************************************************************
+/*******************************************************************
  *
  * @brief Free the RicIndication Message
  *
@@ -873,188 +890,188 @@ uint8_t procRicSubsReq(E2AP_PDU_t *e2apMsg)
  *         
  *
  ******************************************************************/
- void FreeRicIndication(E2AP_PDU_t  *e2apMsg) 
- {
-     uint8_t idx=0;
-     RICindication_t *ricIndicationMsg= NULLP;
+void FreeRicIndication(E2AP_PDU_t  *e2apMsg) 
+{
+   uint8_t idx=0;
+   RICindication_t *ricIndicationMsg= NULLP;
 
 
-     if(e2apMsg != NULLP)
-         {
-             if(e2apMsg->choice.initiatingMessage != NULLP)
-                       {
-                                ricIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.RICindication;
-                           if(ricIndicationMsg!= NULLP)
-                                {
-                                    if(ricIndicationMsg->protocolIEs.list.array != NULLP)
-                                         {
-                                             for(idx=0; idx<ricIndicationMsg->protocolIEs.list.count; idx++)
-                                             {
-                                                      if(ricIndicationMsg->protocolIEs.list.array[idx] != NULLP)
-                                                      {
-                                                          switch(ricIndicationMsg->protocolIEs.list.array[idx]->id)
-                                                                         {
-                                                                             case ProtocolIE_IDE2_id_RICrequestID:
-                                                                                            break;
-
-                                                                                       case ProtocolIE_IDE2_id_RANfunctionID:
-                                                                                            break;
-
-                                                                                       case ProtocolIE_IDE2_id_RICactionID:
-                                                                                            break;
-
-                                                                                       case ProtocolIE_IDE2_id_RICindicationType:
-                                                                                            break;
-
-                                                                                       case ProtocolIE_IDE2_id_RICindicationHeader:
-                                                                                       {
-                                                                                           DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.buf,\
-                                                                                                ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.size);
-                                                                                           break;
-                                                                                       }
-                                                                                       case ProtocolIE_IDE2_id_RICindicationMessage:
-                                                                                       {
-                                                                                           DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.buf,\
-                                                                                                ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.size);
-                                                                                           break;
-                                                                                       }
-                                                                                       default:
-                                                                                          break;
-                                                                         }
-                                                                         DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx],sizeof(RICindication_IEs_t));
-                                                           }
-                                             }
-                                             DU_FREE(ricIndicationMsg->protocolIEs.list.array,ricIndicationMsg->protocolIEs.list.size);
-                                               }
-                                }
-                                DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
-                       }
-             DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
-         }
- }
- /*******************************************************************
 *
 * brief Fill the RicIndication Message
 *
 * @details
 *
 *    Function : FillRicIndication
 *
 * Functionality:Fills the RicIndication Message
 *
 * @return ROK     - success
 *         RFAILED - failure
 *
 ******************************************************************/
+   if(e2apMsg != NULLP)
+   {
+      if(e2apMsg->choice.initiatingMessage != NULLP)
+      {
+        ricIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.RICindication;
+        if(ricIndicationMsg!= NULLP)
+        {
+           if(ricIndicationMsg->protocolIEs.list.array != NULLP)
+           {
+              for(idx=0; idx<ricIndicationMsg->protocolIEs.list.count; idx++)
+              {
+                 if(ricIndicationMsg->protocolIEs.list.array[idx] != NULLP)
+                 {
+                    switch(ricIndicationMsg->protocolIEs.list.array[idx]->id)
+                    {
+                       case ProtocolIE_IDE2_id_RICrequestID:
+                          break;
+
+                       case ProtocolIE_IDE2_id_RANfunctionID:
+                          break;
+
+                       case ProtocolIE_IDE2_id_RICactionID:
+                          break;
+
+                       case ProtocolIE_IDE2_id_RICindicationType:
+                          break;
+
+                       case ProtocolIE_IDE2_id_RICindicationHeader:
+                          {
+                             DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.buf,\
+                                   ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.size);
+                             break;
+                          }
+                       case ProtocolIE_IDE2_id_RICindicationMessage:
+                          {
+                             DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.buf,\
+                                   ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.size);
+                             break;
+                          }
+                       default:
+                          break;
+                    }
+                    DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx],sizeof(RICindication_IEs_t));
+                 }
+              }
+              DU_FREE(ricIndicationMsg->protocolIEs.list.array,ricIndicationMsg->protocolIEs.list.size);
+           }
+        }
+        DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+      }
+      DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
+   }
+}
+/*******************************************************************
+ *
+ * brief Fill the RicIndication Message
+ *
+ * @details
+ *
+ *    Function : FillRicIndication
+ *
+ * Functionality:Fills the RicIndication Message
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ ******************************************************************/
 uint8_t FillRicIndication(RICindication_t *ricIndicationMsg)
 {
    uint8_t elementCnt=0;
    uint8_t idx=0;
    uint8_t ret = ROK;
    elementCnt = 6;
-       
-       ricIndicationMsg->protocolIEs.list.count = elementCnt;
-       ricIndicationMsg->protocolIEs.list.size  = elementCnt * sizeof(RICindication_t);
-       /* Initialize the Ric Indication members */
-       DU_ALLOC(ricIndicationMsg->protocolIEs.list.array, \
-       ricIndicationMsg->protocolIEs.list.size);
-       if(ricIndicationMsg->protocolIEs.list.array == NULLP)
-       {
+
+   ricIndicationMsg->protocolIEs.list.count = elementCnt;
+   ricIndicationMsg->protocolIEs.list.size  = elementCnt * sizeof(RICindication_t);
+   /* Initialize the Ric Indication members */
+   DU_ALLOC(ricIndicationMsg->protocolIEs.list.array, \
+        ricIndicationMsg->protocolIEs.list.size);
+   if(ricIndicationMsg->protocolIEs.list.array == NULLP)
+   {
+      DU_LOG("\nE2AP : Memory allocation for RICindicationIEs failed");
+      ret = RFAILED;
+   }
+   else
+   {
+      for(idx=0; idx<elementCnt; idx++)
+      {
+        DU_ALLOC(ricIndicationMsg->protocolIEs.list.array[idx],\
+              sizeof(RICindication_IEs_t));
+        if(ricIndicationMsg->protocolIEs.list.array[idx] == NULLP)
+        {
            DU_LOG("\nE2AP : Memory allocation for RICindicationIEs failed");
            ret = RFAILED;
-       }
-   else
-       {
-          for(idx=0; idx<elementCnt; idx++)
+        }
+      }
+      if(ret != RFAILED)
       {
-             DU_ALLOC(ricIndicationMsg->protocolIEs.list.array[idx],\
-             sizeof(RICindication_IEs_t));
-             if(ricIndicationMsg->protocolIEs.list.array[idx] == NULLP)
-             {
-                DU_LOG("\nE2AP : Memory allocation for RICindicationIEs failed");
-                ret = RFAILED;
-                       }
-          }
-               if(ret != RFAILED)
-               {
-         idx = 0;
-           
-             ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICrequestID;
-             ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
-                                                       RICindication_IEs__value_PR_RICrequestID;
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID =\
-                       e2apMsgDb.ricReqId;
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID =\
-                       e2apMsgDb.ricInstanceId;
-
-             idx++;
-             ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RANfunctionID;
-             ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
-             RICindication_IEs__value_PR_RANfunctionID;
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RANfunctionID =
-                       e2apMsgDb.ranFuncId;
-               
-             idx++;
-             ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICactionID;
-             ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
-                       RICindication_IEs__value_PR_RICactionID;
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICactionID =
-                       e2apMsgDb.ricActionId;
-                       
-             idx++;
-             ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationType;
-             ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
-                       RICindication_IEs__value_PR_RICindicationType;
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationType =
-                       e2apMsgDb.ricActionType;
-             
-                       idx++;
-         ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationHeader;
-         ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
-             RICindication_IEs__value_PR_RICindicationHeader;
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.size = 3 *
-             sizeof(uint8_t);
-         DU_ALLOC(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.buf ,\
-             ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.size);
-             if(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.buf == NULLP)
-             {
-                DU_LOG("\nE2AP : Memory allocation for RICindicationIEs failed");
-                ret = RFAILED;
-             }
-                  else
-                  {
-                buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
-                ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.buf);
-                idx++;
-            /* TO BE CHANGED: RIC INDICATION DATA */
-            /* For now filling a dummy octect data, need to tested with PRBs*/
-            ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationMessage;
-            ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
-            ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
-            RICindication_IEs__value_PR_RICindicationMessage;
-            ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.size = 3 *
-            sizeof(uint8_t);
-            DU_ALLOC(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.buf ,\
-                       ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.size);
-                               if(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.buf == NULLP)
-                               {
-                               DU_LOG("\nE2AP : Memory allocation for RICindicationIEs failed");
-                               ret = RFAILED;
-                       }
-                               else
-                               {
-                                       buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
-                                       ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.buf);
-                               }
-                       }
-               }
-       }
-       return ret;
+        idx = 0;
+
+        ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICrequestID;
+        ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+        ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
+                                                                       RICindication_IEs__value_PR_RICrequestID;
+        ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID =\
+                                                                                                 e2apMsgDb.ricReqId;
+        ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID =\
+                                                                                                e2apMsgDb.ricInstanceId;
+
+        idx++;
+        ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RANfunctionID;
+        ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+        ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
+                                                                       RICindication_IEs__value_PR_RANfunctionID;
+        ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RANfunctionID =
+           e2apMsgDb.ranFuncId;
+
+        idx++;
+        ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICactionID;
+        ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+        ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
+                                                                       RICindication_IEs__value_PR_RICactionID;
+        ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICactionID =
+           e2apMsgDb.ricActionId;
+
+        idx++;
+        ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationType;
+        ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+        ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
+                                                                       RICindication_IEs__value_PR_RICindicationType;
+        ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationType =
+           e2apMsgDb.ricActionType;
+
+        idx++;
+        ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationHeader;
+        ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+        ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
+                                                                       RICindication_IEs__value_PR_RICindicationHeader;
+        ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.size = 3 *
+           sizeof(uint8_t);
+        DU_ALLOC(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.buf ,\
+              ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.size);
+        if(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.buf == NULLP)
+        {
+           DU_LOG("\nE2AP : Memory allocation for RICindicationIEs failed");
+           ret = RFAILED;
+        }
+        else
+        {
+           buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
+                 ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.buf);
+           idx++;
+           /* TO BE CHANGED: RIC INDICATION DATA */
+           /* For now filling a dummy octect data, need to tested with PRBs*/
+           ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationMessage;
+           ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+           ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
+                                                                          RICindication_IEs__value_PR_RICindicationMessage;
+           ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.size = 3 *
+              sizeof(uint8_t);
+           DU_ALLOC(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.buf ,\
+                 ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.size);
+           if(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.buf == NULLP)
+           {
+              DU_LOG("\nE2AP : Memory allocation for RICindicationIEs failed");
+              ret = RFAILED;
+           }
+           else
+           {
+              buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
+                    ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.buf);
+           }
+        }
+      }
+   }
+   return ret;
 }
 
 /*******************************************************************
@@ -1078,86 +1095,86 @@ uint8_t BuildAndSendRicIndication()
    RICindication_t            *ricIndicationMsg=NULLP;
    asn_enc_rval_t             encRetVal;        /* Encoder return value */
    uint8_t ret = RFAILED; 
-       uint8_t FillRicIndicationret = ROK;
-
-       while(true)
-       {
-        DU_LOG("\nE2AP : Building Ric Indication Message\n");
-
-        DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
-        if(e2apMsg == NULLP)
-        {
-             DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
-             break;
-        }
-
-        e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
-        DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
-        if(e2apMsg->choice.initiatingMessage == NULLP)
-        {
-             DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
-             break;
-        }
-        e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_RICindication;
-        e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
-        e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_RICindication;
-        
-                 ricIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.RICindication;
-               
-                 FillRicIndicationret = FillRicIndication(ricIndicationMsg);
-        if(FillRicIndicationret != ROK)
-                 {
-                     break;
-                 }
-                 /* Prints the Msg formed */
-        xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg);
-        memset(encBuf, 0, ENC_BUF_MAX_LEN);
-                 encBufSize = 0;
-        encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf,\
-               encBuf);
-        if(encRetVal.encoded == ENCODE_FAIL)
-        {
-                DU_LOG("\nE2AP : Could not encode RIC Indication Message (at %s)\n",\
-                          encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-                break;
-        }
-        else
-        {
-           DU_LOG("\nE2AP : Created APER encoded buffer for RIC Indication Message \n");
-               for(int i=0; i< encBufSize; i++)
-               {
-                        printf("%x",encBuf[i]);
-               
-        }
-
-        if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
-        {
-            DU_LOG("\nE2AP : Sending RIC Indication Message");      
-      
-        }
-                 ret = ROK;
-                 break;
+   uint8_t FillRicIndicationret = ROK;
+
+   while(true)
+   {
+      DU_LOG("\nE2AP : Building Ric Indication Message\n");
+
+      DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+      if(e2apMsg == NULLP)
+      {
+        DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
+        break;
+      }
+
+      e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+      DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+      if(e2apMsg->choice.initiatingMessage == NULLP)
+      {
+        DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
+        break;
+      }
+      e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_RICindication;
+      e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+      e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_RICindication;
+
+      ricIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.RICindication;
+
+      FillRicIndicationret = FillRicIndication(ricIndicationMsg);
+      if(FillRicIndicationret != ROK)
+      {
+        break;
+      }
+      /* Prints the Msg formed */
+      xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg);
+      memset(encBuf, 0, ENC_BUF_MAX_LEN);
+      encBufSize = 0;
+      encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf,\
+           encBuf);
+      if(encRetVal.encoded == ENCODE_FAIL)
+      {
+        DU_LOG("\nE2AP : Could not encode RIC Indication Message (at %s)\n",\
+              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+        break;
+      }
+      else
+      {
+        DU_LOG("\nE2AP : Created APER encoded buffer for RIC Indication Message \n");
+        for(int i=0; i< encBufSize; i++)
+        {
+           printf("%x",encBuf[i]);
+        } 
+      }
+
+      if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+      {
+        DU_LOG("\nE2AP : Sending RIC Indication Message");      
+
+      }
+      ret = ROK;
+      break;
    }
    FreeRicIndication(e2apMsg); 
-       return ret;
+   return ret;
 }
 
 /*******************************************************************
-*
-* @brief Sends E2 msg over SCTP
-*
-* @details
-*
-*    Function : SendE2APMsg
-*
-*    Functionality: Sends E2 msg over SCTP
-*
-* @params[in] Region region
-*             Pool pool
-* @return ROK     - success
-*         RFAILED - failure
-*
-* ****************************************************************/
+ *
+ * @brief Sends E2 msg over SCTP
+ *
+ * @details
+ *
+ *    Function : SendE2APMsg
+ *
+ *    Functionality: Sends E2 msg over SCTP
+ *
+ * @params[in] Region region
+ *             Pool pool
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 
 uint8_t SendE2APMsg(Region region, Pool pool)
 {
@@ -1167,20 +1184,20 @@ uint8_t SendE2APMsg(Region region, Pool pool)
    {
       if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
       {
-         ODU_PRINT_MSG(mBuf, 0,0);
-         if(sctpSend(mBuf, E2_INTERFACE) != ROK)
-         {
-            DU_LOG("\nE2AP : SCTP Send for E2  failed");
-            ODU_PUT_MSG_BUF(mBuf);
-            return RFAILED;
-         }
+        ODU_PRINT_MSG(mBuf, 0,0);
+
+        if(sctpSend(mBuf, E2_INTERFACE) != ROK)
+        {
+           DU_LOG("\nE2AP : SCTP Send for E2  failed");
+           ODU_PUT_MSG_BUF(mBuf);
+           return RFAILED;
+        }
       }
       else
       {
-         DU_LOG("\nE2AP : ODU_ADD_POST_MSG_MULT failed");
-         ODU_PUT_MSG_BUF(mBuf);
-         return RFAILED;
+        DU_LOG("\nE2AP : ODU_ADD_POST_MSG_MULT failed");
+        ODU_PUT_MSG_BUF(mBuf);
+        return RFAILED;
       }
       ODU_PUT_MSG_BUF(mBuf);
    }
@@ -1189,40 +1206,40 @@ uint8_t SendE2APMsg(Region region, Pool pool)
       DU_LOG("\nE2AP : Failed to allocate memory");
       return RFAILED;
    }
+
    return ROK;
 } /* SendE2APMsg */
 
 /*******************************************************************
-*
-* @brief Handles received E2AP message and sends back response  
-*
-* @details
-*
-*    Function : E2APMsgHdlr
-*
-*    Functionality:
-*         - Decodes received E2AP control message
-*         - Prepares response message, encodes and sends to SCTP
-*
-* @params[in] 
-* @return ROK     - success
-*         RFAILED - failure
-*
-* ****************************************************************/
+ *
+ * @brief Handles received E2AP message and sends back response  
+ *
+ * @details
+ *
+ *    Function : E2APMsgHdlr
+ *
+ *    Functionality:
+ *         - Decodes received E2AP control message
+ *         - Prepares response message, encodes and sends to SCTP
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 void E2APMsgHdlr(Buffer *mBuf)
 {
-   int i;
-   char *recvBuf;
-   MsgLen copyCnt;
-   MsgLen recvBufLen;
-   E2AP_PDU_t *e2apMsg;
-   asn_dec_rval_t rval; /* Decoder return value */
-   E2AP_PDU_t e2apasnmsg ;
+   int i =0;
+   char *recvBuf = NULLP;
+   MsgLen copyCnt =0;
+   MsgLen recvBufLen =0;
+   E2AP_PDU_t *e2apMsg = NULLP;
+   asn_dec_rval_t rval ={0}; /* Decoder return value */
+   E2AP_PDU_t e2apasnmsg={0} ;
+
    DU_LOG("\nE2AP : Received E2AP message buffer");
    ODU_PRINT_MSG(mBuf, 0,0);
+
    /* Copy mBuf into char array to decode it */
    ODU_GET_MSG_LEN(mBuf, &recvBufLen);
    DU_ALLOC(recvBuf, (Size)recvBufLen);
@@ -1241,16 +1258,16 @@ void E2APMsgHdlr(Buffer *mBuf)
    printf("\nE2AP : Received flat buffer to be decoded : ");
    for(i=0; i< recvBufLen; i++)
    {
-        printf("%x",recvBuf[i]);
+      printf("%x",recvBuf[i]);
    }
 
    /* Decoding flat buffer into E2AP messsage */
    e2apMsg = &e2apasnmsg;
    memset(e2apMsg, 0, sizeof(E2AP_PDU_t));
+
    rval = aper_decode(0, &asn_DEF_E2AP_PDU, (void **)&e2apMsg, recvBuf, recvBufLen, 0, 0);
    DU_FREE(recvBuf, (Size)recvBufLen);
-   
+
    if(rval.code == RC_FAIL || rval.code == RC_WMORE)
    {
       DU_LOG("\nE2AP : ASN decode failed");
@@ -1262,57 +1279,60 @@ void E2APMsgHdlr(Buffer *mBuf)
    switch(e2apMsg->present)
    {
       case E2AP_PDU_PR_successfulOutcome:
-      {
-         switch(e2apMsg->choice.successfulOutcome->value.present)
-         {
-            case SuccessfulOutcomeE2__value_PR_E2setupResponse:
-            {
-               if(!duCb.e2Status)
-               {
-                 DU_LOG("\nE2AP : Store E2 setup response Params");
-                 procE2SetupRsp(e2apMsg);
-               }
-              break;
-            }
-            default:
-            {
-               DU_LOG("\nE2AP : Invalid type of intiating message [%d]", e2apMsg->choice.initiatingMessage->value.present);
-               return;
-            }
-         }/* End of switch(successfulOutcome) */
-         break;
-      }
+        {
+           switch(e2apMsg->choice.successfulOutcome->value.present)
+           {
+              case SuccessfulOutcomeE2__value_PR_E2setupResponse:
+                 {
+                    if(!duCb.e2Status)
+                    {
+                       DU_LOG("\nE2AP : Store E2 setup response Params");
+                       procE2SetupRsp(e2apMsg);
+                    }
+                    break;
+                 }
+              default:
+                 {
+                    DU_LOG("\nE2AP : Invalid type of sucessful message [%d]", e2apMsg->choice.successfulOutcome->value.present);
+                    return;
+                 }
+           }/* End of switch(successfulOutcome) */
+           free(e2apMsg->choice.successfulOutcome);
+           break;
+        }
       case E2AP_PDU_PR_initiatingMessage:
-      {
-         switch(e2apMsg->choice.initiatingMessage->value.present)
-         {
-            case InitiatingMessageE2__value_PR_RICsubscriptionRequest: 
-            {
-               DU_LOG("\nE2AP : Calling RIC Subscription Response");
-              if(procRicSubsReq(e2apMsg) == ROK)
-               {
-                  BuildAndSendRicIndication();
-               }
-               break;
-            }
-            default:
-            {
-               DU_LOG("\nE2AP : Invalid type of successfulOutcome message [%d]", e2apMsg->choice.successfulOutcome->value.present);
-               return;
-            }
-         }/* End of switch(initiatingMessage) */
-         break;
-      }
+        {
+           switch(e2apMsg->choice.initiatingMessage->value.present)
+           {
+              case InitiatingMessageE2__value_PR_RICsubscriptionRequest: 
+                 {
+                    DU_LOG("\nE2AP : Calling RIC Subscription Response");
+                    if(procRicSubsReq(e2apMsg) == ROK)
+                    {
+                       BuildAndSendRicIndication();
+                    }
+                    break;
+                 }
+              default:
+                 {
+                    DU_LOG("\nE2AP : Invalid type of intiating message [%d]", e2apMsg->choice.initiatingMessage->value.present);
+                    return;
+                 }
+           }/* End of switch(initiatingMessage) */
+           free(e2apMsg->choice.initiatingMessage);
+           break;
+        }
       default:
-      {
-         DU_LOG("\nE2AP : Invalid type of e2apMsg->present [%d]",e2apMsg->present);
-         return;
-      }
+        {
+           DU_LOG("\nE2AP : Invalid type of e2apMsg->present [%d]",e2apMsg->present);
+           return;
+        }
+        free(e2apMsg);
 
    }/* End of switch(e2apMsg->present) */
+
 } /* End of E2APMsgHdlr */
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index ca02b47..ec001ea 100644 (file)
@@ -715,20 +715,20 @@ uint8_t BuildRrcVer(RRC_Version_t *rrcVer)
  * ****************************************************************/
 uint8_t SendF1APMsg(Region region, Pool pool)
 {
-   Buffer *mBuf;
-
+   Buffer *mBuf = NULLP;
+  
    if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK)
    {
       if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
       {
-        ODU_PRINT_MSG(mBuf, 0,0);
+           ODU_PRINT_MSG(mBuf, 0,0);
 
-        if(sctpSend(mBuf, F1_INTERFACE) != ROK)
-        {
-           DU_LOG("\nF1AP : SCTP Send failed");
-           ODU_PUT_MSG_BUF(mBuf);
-           return RFAILED;
-        }
+           if(sctpSend(mBuf, F1_INTERFACE) != ROK)
+           {
+              DU_LOG("\nF1AP : SCTP Send failed");
+              ODU_PUT_MSG_BUF(mBuf);
+              return RFAILED;
+           }
       }
       else
       {
@@ -2081,13 +2081,16 @@ void FreeULRRCMessageTransfer( F1AP_PDU_t *f1apMsg)
 uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId, \
       uint16_t msgLen, uint8_t *rrcMsg)
 {
-   uint8_t   elementCnt;
-   uint8_t   idx1;
-   uint8_t   idx;
-   F1AP_PDU_t                  *f1apMsg = NULL;
-   ULRRCMessageTransfer_t      *ulRRCMsg;
+   uint8_t   elementCnt =0;
+   uint8_t   idx1 =0;
+   uint8_t   idx =0;
+   F1AP_PDU_t                  *f1apMsg = NULLP;
+   ULRRCMessageTransfer_t      *ulRRCMsg = NULLP;
    asn_enc_rval_t              encRetVal;        /* Encoder return value */
    uint8_t ret =RFAILED;
+   
+   memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
+
    while(true)
    {
       DU_LOG("\n F1AP : Building UL RRC Message Transfer Message\n");
@@ -2098,7 +2101,6 @@ uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId, \
         DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
         break;
       }
-
       f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
       DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
       if(f1apMsg->choice.initiatingMessage == NULLP)
@@ -2167,11 +2169,12 @@ uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId, \
       ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size = msgLen;
       DU_ALLOC(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
            ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size)
-        if(!ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf)
-        {
-           DU_LOG(" F1AP : Memory allocation for BuildAndSendULRRCMessageTransfer failed");
-           break;
-        }
+      if(!ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf)
+      {
+        DU_LOG(" F1AP : Memory allocation for BuildAndSendULRRCMessageTransfer failed");
+        break;
+      }
+      memset(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, 0, msgLen);
       memcpy(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, \
            rrcMsg, ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size);
 
@@ -4465,7 +4468,7 @@ void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationL
  *
  * @return void
  *
4221 * ****************************************************************/
+ * ****************************************************************/
 void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
 {
    uint8_t idx1=0;
@@ -5527,14 +5530,13 @@ void  freeMacLcCfg(LcCfg *lcCfg)
    }
    memset(lcCfg, 0, sizeof(LcCfg));
 }
-
 /*******************************************************************
  *
  * @brief Free UE NR Capability received in UE Context setup request
  *
  * @details
  *
- *    Function : freeUeNrCapability
+ *    Function : freeAperDecodeUeNrCapability
  *
  *    Functionality:  
  *       Free UE NR Capability received in UE Context setup request
@@ -5544,18 +5546,18 @@ void  freeMacLcCfg(LcCfg *lcCfg)
  *         RFAILED - failure
  *
  * ****************************************************************/
-void freeUeNrCapability(void *ueNrCapability)
+void freeAperDecodeUeNrCapability(void *ueNrCapability)
 {
-   uint8_t idx;
-   FeatureSets_t *featureSets;
+   uint8_t arrIdx =0;
+   FeatureSets_t *featureSets =NULLP;
    UE_NR_Capability_t *ueNrCap = (UE_NR_Capability_t *)ueNrCapability;
 
    if(ueNrCap->rf_Parameters.supportedBandListNR.list.array)
    {
-      for(idx = 0; idx < ueNrCap->rf_Parameters.supportedBandListNR.list.count; idx++)
+      for(arrIdx = 0; arrIdx < ueNrCap->rf_Parameters.supportedBandListNR.list.count; arrIdx++)
       {
-         if(ueNrCap->rf_Parameters.supportedBandListNR.list.array[idx])
-            free(ueNrCap->rf_Parameters.supportedBandListNR.list.array[idx]);
+         if(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx])
+            free(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx]);
       }
       free(ueNrCap->rf_Parameters.supportedBandListNR.list.array);
    }
@@ -5567,13 +5569,13 @@ void freeUeNrCapability(void *ueNrCapability)
       {
          if(featureSets->featureSetsDownlinkPerCC->list.array)
          {
-            for(idx = 0; idx < featureSets->featureSetsDownlinkPerCC->list.count; idx++)
+            for(arrIdx = 0; arrIdx < featureSets->featureSetsDownlinkPerCC->list.count; arrIdx++)
             {
-               if(featureSets->featureSetsDownlinkPerCC->list.array[idx])
+               if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx])
                {
-                  if(featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedModulationOrderDL)
-                     free(featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedModulationOrderDL);
-                  free(featureSets->featureSetsDownlinkPerCC->list.array[idx]);
+                  if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL)
+                     free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL);
+                  free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]);
                }
             }
             free(featureSets->featureSetsDownlinkPerCC->list.array);
@@ -5584,13 +5586,13 @@ void freeUeNrCapability(void *ueNrCapability)
       {
          if(featureSets->featureSetsUplinkPerCC->list.array)
          {
-            for(idx = 0; idx < featureSets->featureSetsUplinkPerCC->list.count; idx++)
+            for(arrIdx = 0; arrIdx < featureSets->featureSetsUplinkPerCC->list.count; arrIdx++)
             {
-               if(featureSets->featureSetsUplinkPerCC->list.array[idx])
+               if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx])
                {
-                  if(featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedModulationOrderUL)
-                     free(featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedModulationOrderUL);
-                  free(featureSets->featureSetsUplinkPerCC->list.array[idx]);
+                  if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL)
+                     free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL);
+                  free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]);
                }
             }
             free(featureSets->featureSetsUplinkPerCC->list.array);
@@ -5602,167 +5604,788 @@ void freeUeNrCapability(void *ueNrCapability)
 }
 
 /*******************************************************************
- *
- * @brief Function to free DuUeCfg
- *
- * @details
- *
- *    Function : freeDuUeCfg
- *
- *    Functionality: Function to free DuUeCfg
- *
- * @params[in] DuUeCfg *ueCfg
- * @return void
- *
- * ****************************************************************/
-void freeDuUeCfg(DuUeCfg *ueCfg)
+*
+* @brief Function to free PdcchSearchSpcToAddModList
+         where memory allocated by aper_decoder
+*
+* @details
+*
+*    Function : freeAperDecodePdcchSearchSpcToAddModList 
+*
+*    Functionality: Function to free PdcchSearchSpcToAddModList
+*
+* @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
+* @return void
+*
+* ****************************************************************/
+
+void freeAperDecodePdcchSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
 {
-   uint8_t lcIdx;
+   uint8_t searchSpcArrIdx=0;
+   uint8_t searchSpcArrIdx1=0;
+   struct  SearchSpace *searchSpc=NULLP;
 
-   if(ueCfg->ueNrCapability)
-   {
-      freeUeNrCapability(ueCfg->ueNrCapability);
-      DU_FREE(ueCfg->ueNrCapability, sizeof(UE_NR_Capability_t));
-      ueCfg->ueNrCapability = NULLP;
-   }
-   if(ueCfg->cellGrpCfg)
-   {
-      DU_FREE(ueCfg->cellGrpCfg, sizeof(CellGroupConfigRrc_t));
-      ueCfg->cellGrpCfg = NULLP;
-   }
-   if(ueCfg->ambrCfg)
-   {
-      memset(ueCfg->ambrCfg, 0, sizeof(AmbrCfg));
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->ambrCfg, sizeof(AmbrCfg));
-   }
-   for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++)
-   {
-      freeRlcLcCfg(&ueCfg->rlcLcCfg[lcIdx]);
-   }
-   for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++)
+
+   if(searchSpcList->list.array)
    {
-      freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]);
+      if(searchSpcList->list.array[searchSpcArrIdx1])
+      {
+        searchSpc = searchSpcList->list.array[searchSpcArrIdx1];
+        if(searchSpc->controlResourceSetId)
+        {
+           if(searchSpc->monitoringSlotPeriodicityAndOffset)
+           {
+              if(searchSpc->monitoringSymbolsWithinSlot)
+              {
+                 if(searchSpc->monitoringSymbolsWithinSlot->buf)
+                 {
+                    if(searchSpc->nrofCandidates)
+                    {
+                       if(searchSpc->searchSpaceType)
+                       {
+                          free(searchSpc->searchSpaceType->choice.ue_Specific);
+                          free(searchSpc->searchSpaceType);
+                       }
+                       free(searchSpc->nrofCandidates);
+                    }
+                    free(searchSpc->monitoringSymbolsWithinSlot->buf);
+                 }
+                 free(searchSpc->monitoringSymbolsWithinSlot);
+              }
+              free(searchSpc->monitoringSlotPeriodicityAndOffset);
+           }
+           free(searchSpc->controlResourceSetId);
+        }
+      }
+      for(searchSpcArrIdx = 0; searchSpcArrIdx < searchSpcList->list.count; searchSpcArrIdx++)
+      {
+        free(searchSpcList->list.array[searchSpcArrIdx]);
+      }
+      free(searchSpcList->list.array);
    }
 }
-
 /*******************************************************************
- *
- * @brief Function to free UecontextSetupDb
- *
- * @details
- *
- *    Function : freeF1UeDb
- *
- *    Functionality: Function to free UecontextSetupDb
- *
- * @params[in] UecontextSetupDb *
- * @return void
- *
- * ****************************************************************/
+*
+* @brief Function for free part for the memory allocated by aper_decoder
+* 
+* @details
+*
+*    Function : freeAperDecodeBWPDlDedPdcchConfig
+*
+*    Functionality: Function to free BWPDlDedPdcchConfig
+*
+* @params[in] 
+* @return void
+*
+* ****************************************************************/
 
-void freeF1UeDb(F1UeContextSetupDb *f1UeDb)
+
+void freeAperDecodeBWPDlDedPdcchConfig(BWP_DownlinkDedicated_t *dlBwp)
 {
+   uint8_t arrIdx1=0;
+   uint8_t arrIdx2=0;
+   struct PDCCH_Config *pdcchCfg=NULLP;
+   struct ControlResourceSet *controlRSet=NULLP;
+   struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
    
-   if(f1UeDb->dlRrcMsg)
+   if(dlBwp->pdcch_Config->choice.setup)
    {
-      if(f1UeDb->dlRrcMsg->rrcMsgPdu)
+      pdcchCfg=dlBwp->pdcch_Config->choice.setup;
+      if(pdcchCfg->controlResourceSetToAddModList)
       {
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\
-           f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize);
+        controlRSetList = pdcchCfg->controlResourceSetToAddModList;
+        if(controlRSetList->list.array)
+        {
+           controlRSet = controlRSetList->list.array[arrIdx2];
+           if(controlRSet)
+           {
+              if(controlRSet->frequencyDomainResources.buf)
+              {
+                 if(controlRSet->pdcch_DMRS_ScramblingID)
+                 {
+                    if(pdcchCfg->searchSpacesToAddModList)
+                    {
+                       freeAperDecodePdcchSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
+                       free(pdcchCfg->searchSpacesToAddModList);
+                    }
+                    free(controlRSet->pdcch_DMRS_ScramblingID);
+                 }
+                 free(controlRSet->frequencyDomainResources.buf);
+              }
+           }
+           for(arrIdx1 = 0; arrIdx1 <controlRSetList->list.count; arrIdx1++)
+           {
+              free(controlRSetList->list.array[arrIdx1]);
+           }
+           free(controlRSetList->list.array);
+        }
+        free(pdcchCfg->controlResourceSetToAddModList);
       }
-      memset(f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
+      free(dlBwp->pdcch_Config->choice.setup);
    }
-   freeDuUeCfg(&f1UeDb->duUeCfg);
-   memset(f1UeDb, 0, sizeof(F1UeContextSetupDb));
-   DU_FREE(f1UeDb, sizeof(F1UeContextSetupDb));
 }
-
 /*******************************************************************
- *
- * @brief Function to build Am cfg Info
- *
- * @details
- *
- *    Function : extractRlcAmCfg
- *
- *    Functionality: Function to build Am cfg Info
- *
- * @params[in] AmBearerCfg *
- *             void *
- *
- * @return ROK/RFAILED
- *
- * ****************************************************************/
+*
+* @brief Function to free PdschTimeDomAllocationList 
+*     where the memory allocated by aper_decoder
+* 
+* @details
+*
+*    Function : freeAperDecodePdschTimeDomAllocationList
+*
+*    Functionality: Function to free PdschTimeDomAllocationList
+*
+* @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList 
+* @return void
+*
+* ****************************************************************/
 
-void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg)
+
+void freeAperDecodePdschTimeDomAllocationList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
 {
-   if(rlcAmCfg)
-   {
-      /* UL AM */
-      if(rlcAmCfg->dl_AM_RLC.sn_FieldLength)
-      {
-        amCfgToSet->ulAmCfg.snLenUl = *(rlcAmCfg->dl_AM_RLC.sn_FieldLength);
-        amCfgToSet->ulAmCfg.reAssemTmr = rlcAmCfg->dl_AM_RLC.t_Reassembly;
-        amCfgToSet->ulAmCfg.statProhTmr = rlcAmCfg->dl_AM_RLC.t_StatusProhibit;
-      }
+   uint8_t arrIdx=0;
 
-      /* DL AM */
-      if(rlcAmCfg->ul_AM_RLC.sn_FieldLength)
+   if(timeDomAllocList->choice.setup)
+   {
+      if(timeDomAllocList->choice.setup->list.array)
       {
-        amCfgToSet->dlAmCfg.snLenDl = *(rlcAmCfg->ul_AM_RLC.sn_FieldLength);
-        amCfgToSet->dlAmCfg.pollRetxTmr = rlcAmCfg->ul_AM_RLC.t_PollRetransmit;
-        amCfgToSet->dlAmCfg.pollPdu   = rlcAmCfg->ul_AM_RLC.pollPDU;
-        amCfgToSet->dlAmCfg.pollByte  = rlcAmCfg->ul_AM_RLC.pollByte;
-        amCfgToSet->dlAmCfg.maxRetxTh = rlcAmCfg->ul_AM_RLC.maxRetxThreshold;
+        for(arrIdx = 0; arrIdx <timeDomAllocList->choice.setup->list.count ; arrIdx++)
+        {
+           free(timeDomAllocList->choice.setup->list.array[arrIdx]);
+        }
+        free(timeDomAllocList->choice.setup->list.array);
       }
+      free(timeDomAllocList->choice.setup);
    }
 }
 
 /*******************************************************************
- *
- * @brief Function to build Um Bi Info
- *
- * @details
- *
- *    Function : extractRlcUmBiCfg
- *
- *    Functionality: Function to build Um Bi Info
- *
- * @params[in] UmBiDirBearerCfg *
- *             void *
- *
- * @return ROK/RFAILED
- *
- * ****************************************************************/
+*
+* @brief Function to free BWPDlDedPdschConfig 
+*        where the memory allocated by aper_decoder
+*  
+* @details
+*
+*    Function : freeAperDecodeBWPDlDedPdschConfig 
+*
+*    Functionality: Function to free BWPDlDedPdschConfig 
+*
+* @params[in] BWP_DownlinkDedicated_t *dlBwp 
+* @return void
+*
+* ****************************************************************/
 
-void extractRlcUmBiCfg(UmBiDirBearerCfg *umBiCfgToSet, struct RLC_Config__um_Bi_Directional *rlcBiCfg)
+
+void freeAperDecodeBWPDlDedPdschConfig(BWP_DownlinkDedicated_t *dlBwp)
 {
-   if(rlcBiCfg)
+   struct PDSCH_Config *pdschCfg=NULLP;
+   struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
+   struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
+   struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
+
+   if(dlBwp->pdsch_Config->choice.setup)
    {
-      /* UL UM BI DIR Cfg */
-      if(rlcBiCfg->dl_UM_RLC.sn_FieldLength)
+      pdschCfg=dlBwp->pdsch_Config->choice.setup;
+      if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
       {
-        umBiCfgToSet->ulUmCfg.snLenUlUm  = *(rlcBiCfg->dl_UM_RLC.sn_FieldLength);
-        umBiCfgToSet->ulUmCfg.reAssemTmr = rlcBiCfg->dl_UM_RLC.t_Reassembly;
+        if(pdschCfg->pdsch_TimeDomainAllocationList)
+        {
+           timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
+           if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
+           {
+              prbBndlType=&pdschCfg->prb_BundlingType;
+              free(prbBndlType->choice.staticBundling);
+              free(pdschCfg->maxNrofCodeWordsScheduledByDCI);
+           }
+           freeAperDecodePdschTimeDomAllocationList(timeDomAllocList);
+           free(pdschCfg->pdsch_TimeDomainAllocationList);
+        }
+        dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
+        if(dmrsDlCfg->choice.setup)
+        {
+           free(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition);
+           free(dmrsDlCfg->choice.setup);
+        }
+        free(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA);
       }
-
-      /* DL UM BI DIR Cfg */
-      if(rlcBiCfg->ul_UM_RLC.sn_FieldLength)
-        umBiCfgToSet->dlUmCfg.snLenDlUm  = *(rlcBiCfg->ul_UM_RLC.sn_FieldLength);
+      free(dlBwp->pdsch_Config->choice.setup);
    }
 }
-
 /*******************************************************************
- *
- * @brief Function to build Um Ul Info
- *
- * @details
- *
- *    Function : extractRlcUmUlCfg
- *
- *    Functionality: Function to build Um Ul Info
- *
- * @params[in] UmUniDirUlBearerCfg *
+*
+* @brief Function to free PuschTimeDomAllocListCfg
+                 where the memory allocated by aper_decoder
+*
+* @details
+*
+*    Function : freeAperDecodePuschTimeDomAllocListCfg
+*
+*    Functionality: Function to free PuschTimeDomAllocListCfg
+*
+* @params[in] PUSCH_Config_t *puschCfg 
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodePuschTimeDomAllocListCfg(PUSCH_Config_t *puschCfg)
+{
+   uint8_t arrIdx=0;
+   uint8_t arrIdx1=0;
+   struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
+
+   if(puschCfg->pusch_TimeDomainAllocationList)
+   {
+      timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
+      if(timeDomAllocList_t->choice.setup)
+      {
+        if(timeDomAllocList_t->choice.setup->list.array)
+        {
+           free(timeDomAllocList_t->choice.setup->list.array[arrIdx1]->k2);
+           for(arrIdx = 0; arrIdx<timeDomAllocList_t->choice.setup->list.count; arrIdx++)
+           {
+              free(timeDomAllocList_t->choice.setup->list.array[arrIdx]);
+           }
+           free(timeDomAllocList_t->choice.setup->list.array);
+        }
+        free(timeDomAllocList_t->choice.setup);
+      }
+      free(puschCfg->transformPrecoder);
+      free(puschCfg->pusch_TimeDomainAllocationList);
+   }
+}
+/*******************************************************************
+*
+* @brief Function to free InitialUlBWPConfig where memory allocated by aper_decoder
+*
+* @details
+*
+*    Function : freeAperDecodeInitialUlBWPConfig 
+*
+*    Functionality: Function to free InitialUlBWPConfig
+*
+* @params[in]  BWP_UplinkDedicated_t *ulBwp
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeInitialUlBWPConfig(BWP_UplinkDedicated_t *ulBwp)
+{
+   uint8_t  rSetIdx =0;
+   uint8_t  rsrcIdx =0;
+   SRS_Config_t   *srsCfg = NULLP;
+   PUSCH_Config_t *puschCfg = NULLP;
+   struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
+   struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
+   struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
+   struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
+
+   if(ulBwp->pusch_Config)
+   {
+      if(ulBwp->pusch_Config->choice.setup)
+      {
+        puschCfg=ulBwp->pusch_Config->choice.setup;
+        if(puschCfg->dataScramblingIdentityPUSCH)
+        {
+           if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
+           {
+              freeAperDecodePuschTimeDomAllocListCfg(puschCfg);
+              dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
+              if(dmrsUlCfg->choice.setup)
+              {
+                 if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
+                 {
+                    if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
+                    {
+                       free(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0);
+                       free(dmrsUlCfg->choice.setup->transformPrecodingDisabled);
+                    }
+                    free(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition);
+                 }
+                 free(dmrsUlCfg->choice.setup);
+              }
+              free(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA);
+           }
+           free(puschCfg->dataScramblingIdentityPUSCH);
+        }
+        free(ulBwp->pusch_Config->choice.setup);
+      }
+      free(ulBwp->pusch_Config);
+
+      /* Free SRS-Config */
+      if(ulBwp->srs_Config)
+      {
+        if(ulBwp->srs_Config->choice.setup)
+        {
+           srsCfg = ulBwp->srs_Config->choice.setup;
+
+           /* Free Resource Set to add/mod list */
+           if(srsCfg->srs_ResourceSetToAddModList)
+           {
+              rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
+              if(rsrcSetList->list.array)
+              {
+                 rSetIdx = 0;
+
+                 /* Free SRS resource Id list in this SRS resource set */
+                 if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
+                 {
+                    rsrcIdList =
+                       rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
+
+                    if(rsrcIdList->list.array)
+                    {
+                       for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count;
+                             rsrcIdx++)
+                       {
+                          free(rsrcIdList->list.array[rsrcIdx]);
+                       }
+                       free(rsrcIdList->list.array);
+                    }
+                    free(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList);
+                 }
+
+                 /* Free resource type info for this SRS resource set */
+
+                 free(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic);
+
+                 /* Free memory for each resource set */
+                 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
+                 {
+                    free(rsrcSetList->list.array[rSetIdx]);
+                 }
+                 free(rsrcSetList->list.array);
+              }
+              free(srsCfg->srs_ResourceSetToAddModList);
+           }
+
+           /* Free resource to add/modd list */
+           if(srsCfg->srs_ResourceToAddModList)
+           {
+              resourceList = srsCfg->srs_ResourceToAddModList;
+              if(resourceList->list.array)
+              {
+                 rsrcIdx = 0;
+
+                 free(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2);
+                 free(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic);
+
+                 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
+                 {
+                    free(resourceList->list.array[rsrcIdx]);
+                 }
+                 free(resourceList->list.array);
+              }
+              free(srsCfg->srs_ResourceToAddModList);
+           }
+
+           free(ulBwp->srs_Config->choice.setup);
+        }
+        free(ulBwp->srs_Config);
+      }
+   }
+}
+/*******************************************************************
+*
+* @brief Function to free initialUplinkBWPConfig where memory allocated by aper_decoder
+*
+* @details
+*
+*    Function : freeAperDecodeinitialUplinkBWPConfig
+*
+*    Functionality: Function to free initialUplinkBWPConfig
+*
+* @params[in] UplinkConfig_t *ulCfg 
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeinitialUplinkBWPConfig(UplinkConfig_t *ulCfg)
+{
+   BWP_UplinkDedicated_t *ulBwp=NULLP;
+   struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
+   
+   if(ulCfg->initialUplinkBWP)
+   {
+      ulBwp=ulCfg->initialUplinkBWP;
+      if(ulCfg->firstActiveUplinkBWP_Id)
+      {
+        if(ulCfg->pusch_ServingCellConfig)
+        {
+           puschCfg=ulCfg->pusch_ServingCellConfig;
+           if(puschCfg->choice.setup)
+           {
+              if(puschCfg->choice.setup->ext1)
+              {
+                 free(puschCfg->choice.setup->ext1->processingType2Enabled);
+                 free(puschCfg->choice.setup->ext1->maxMIMO_Layers);
+                 free(puschCfg->choice.setup->ext1);
+              }
+              free(puschCfg->choice.setup);
+           }
+           free(ulCfg->pusch_ServingCellConfig);
+        }
+        free(ulCfg->firstActiveUplinkBWP_Id);
+      }
+      freeAperDecodeInitialUlBWPConfig(ulBwp);
+      free(ulCfg->initialUplinkBWP);
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to free DuUeCfg
+ *
+ * @details
+ *
+ *    Function : freeDuUeCfg
+ *
+ *    Functionality: Function to free DuUeCfg
+ *
+ * @params[in] DuUeCfg *ueCfg
+ * @return void
+ *
+ * ****************************************************************/
+void freeDuUeCfg(DuUeCfg *ueCfg)
+{
+   uint8_t lcIdx = 0;
+   uint8_t arrIdx = 0;
+   SpCellConfig_t *spCellCfg = NULLP;
+   ServingCellConfig_t *srvCellCfg = NULLP;
+   BWP_DownlinkDedicated_t *dlBwp = NULLP;
+   MAC_CellGroupConfig_t *macCellGrpCfg = NULLP;
+   PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
+   struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList = NULLP;
+   struct RLC_Config *rlcConfig = NULLP;
+   struct LogicalChannelConfig *macLcConfig = NULLP;
+   struct SchedulingRequestConfig *schedulingRequestConfig = NULLP;
+   struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList = NULLP;
+   struct TAG_Config *tagConfig = NULLP;
+   struct TAG_Config__tag_ToAddModList *tagList = NULLP;
+   struct MAC_CellGroupConfig__phr_Config *phrConfig = NULLP;
+   struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg = NULLP;
+   CellGroupConfigRrc_t *cellGrpCfg = ueCfg->cellGrpCfg;
+  
+   if(ueCfg->ueNrCapability)
+   {
+      freeAperDecodeUeNrCapability(ueCfg->ueNrCapability);
+      DU_FREE(ueCfg->ueNrCapability, sizeof(UE_NR_Capability_t));
+      ueCfg->ueNrCapability = NULLP;
+   }
+
+   if(ueCfg->cellGrpCfg)
+   {
+      
+      rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
+      if(rlcBearerList)
+      {
+        if(rlcBearerList->list.array)
+        {
+           for(arrIdx=0; arrIdx<rlcBearerList->list.count; arrIdx++)
+           {
+              if(rlcBearerList->list.array[arrIdx])
+              {
+                 rlcConfig   = rlcBearerList->list.array[arrIdx]->rlc_Config;
+                 macLcConfig = rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig;
+                 
+                 if(rlcBearerList->list.array[arrIdx]->servedRadioBearer)
+                 {
+                    free(rlcBearerList->list.array[arrIdx]->servedRadioBearer);
+                 }
+                 if(rlcConfig)
+                 {
+                    if(rlcConfig->choice.am)
+                    {
+                       free(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength);
+                       free(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength);
+                       free(rlcConfig->choice.am);
+                    }
+                    free(rlcBearerList->list.array[arrIdx]->rlc_Config);
+                 }
+                 if(macLcConfig)
+                 {
+                    if(macLcConfig->ul_SpecificParameters)
+                    {
+                       free(macLcConfig->ul_SpecificParameters->schedulingRequestID);
+                       free(macLcConfig->ul_SpecificParameters->logicalChannelGroup);
+                       free(macLcConfig->ul_SpecificParameters);
+                    }
+                    free(rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig);
+                 }
+                 free(rlcBearerList->list.array[arrIdx]); 
+              }
+           }
+           free(rlcBearerList->list.array);
+        }
+        free(cellGrpCfg->rlc_BearerToAddModList);
+      }
+
+      macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
+      if(macCellGrpCfg)
+      {
+        schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig;
+        if(schedulingRequestConfig)
+        {
+           schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
+           if(schReqList)
+           {
+              if(schReqList->list.array)
+              {
+                 for(arrIdx=0;arrIdx<schReqList->list.count; arrIdx++)
+                 {
+                    if(schReqList->list.array[arrIdx])
+                    {
+                       free(schReqList->list.array[arrIdx]->sr_ProhibitTimer); 
+                       free(schReqList->list.array[arrIdx]);
+                    }
+                 }
+                 free(schReqList->list.array);
+              }
+              free(schedulingRequestConfig->schedulingRequestToAddModList);
+           }
+           free(macCellGrpCfg->schedulingRequestConfig);
+        }
+        if(macCellGrpCfg->bsr_Config)
+        {
+           free(macCellGrpCfg->bsr_Config);
+        }
+        tagConfig = macCellGrpCfg->tag_Config;
+        if(tagConfig)
+        {
+           tagList = tagConfig->tag_ToAddModList;
+           if(tagList)
+           {
+              if(tagList->list.array)
+              {
+                 for(arrIdx=0; arrIdx<tagList->list.count; arrIdx++)
+                 {
+                    free(tagList->list.array[arrIdx]);
+                 }
+                 free(tagList->list.array);
+              }
+              free(tagConfig->tag_ToAddModList);
+           }
+           free(tagConfig); 
+        }
+
+        phrConfig = macCellGrpCfg->phr_Config;
+        if(phrConfig)
+        {
+           free(phrConfig->choice.setup); 
+           free(phrConfig); 
+        }
+
+        free(macCellGrpCfg); 
+      }
+
+      phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
+      if(phyCellGrpCfg)
+      {
+        free(phyCellGrpCfg->p_NR_FR1);
+        free(phyCellGrpCfg); 
+      }
+
+      spCellCfg = cellGrpCfg->spCellConfig;
+      if(spCellCfg)
+      {
+        if(spCellCfg->servCellIndex)
+        {
+           if(spCellCfg->rlmInSyncOutOfSyncThreshold)
+           {
+              if(spCellCfg->spCellConfigDedicated)
+              {
+                 srvCellCfg = spCellCfg->spCellConfigDedicated;
+                 if(srvCellCfg->initialDownlinkBWP)
+                 {
+                    dlBwp = srvCellCfg->initialDownlinkBWP;
+                    if(srvCellCfg->firstActiveDownlinkBWP_Id)
+                    {
+                       if(srvCellCfg->defaultDownlinkBWP_Id)
+                       {
+                          if(srvCellCfg->uplinkConfig)
+                          {
+
+                             if(srvCellCfg->pdsch_ServingCellConfig)
+                             {
+                                pdschCfg=
+                                   srvCellCfg->pdsch_ServingCellConfig;
+                                if(pdschCfg->choice.setup)
+                                {
+
+                                   free(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH);
+                                   free(pdschCfg->choice.setup);
+                                }
+
+                                free(srvCellCfg->pdsch_ServingCellConfig);
+                             }
+
+                             freeAperDecodeinitialUplinkBWPConfig(srvCellCfg->uplinkConfig);
+                             free(srvCellCfg->uplinkConfig);
+                          }
+                          free(srvCellCfg->defaultDownlinkBWP_Id);
+                       }
+
+                       free(srvCellCfg->firstActiveDownlinkBWP_Id);
+                    }
+                    if(dlBwp->pdcch_Config)
+                    {
+                       if(dlBwp->pdsch_Config)
+                       {
+                          freeAperDecodeBWPDlDedPdschConfig(dlBwp);
+                          free(dlBwp->pdsch_Config);
+                       }
+                       freeAperDecodeBWPDlDedPdcchConfig(dlBwp);
+                       free(dlBwp->pdcch_Config);
+                    }
+                    free(srvCellCfg->initialDownlinkBWP);
+                 }
+
+                 free(spCellCfg->spCellConfigDedicated);
+              }
+              free(spCellCfg->rlmInSyncOutOfSyncThreshold);
+           }
+           free(spCellCfg->servCellIndex); 
+        }
+        free(spCellCfg);
+      }
+      DU_FREE(ueCfg->cellGrpCfg, sizeof(CellGroupConfigRrc_t));
+      ueCfg->cellGrpCfg = NULLP;
+   }
+   if(ueCfg->ambrCfg)
+   {
+      memset(ueCfg->ambrCfg, 0, sizeof(AmbrCfg));
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->ambrCfg, sizeof(AmbrCfg));
+   }
+   for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++)
+   {
+      freeRlcLcCfg(&ueCfg->rlcLcCfg[lcIdx]);
+   }
+   for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++)
+   {
+      freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]);
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to free UecontextSetupDb
+ *
+ * @details
+ *
+ *    Function : freeF1UeDb
+ *
+ *    Functionality: Function to free UecontextSetupDb
+ *
+ * @params[in] UecontextSetupDb *
+ * @return void
+ *
+ * ****************************************************************/
+
+void freeF1UeDb(F1UeContextSetupDb *f1UeDb)
+{
+   
+   if(f1UeDb->dlRrcMsg)
+   {
+      if(f1UeDb->dlRrcMsg->rrcMsgPdu)
+      {
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\
+           f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize);
+      }
+      memset(f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
+   }
+   freeDuUeCfg(&f1UeDb->duUeCfg);
+   memset(f1UeDb, 0, sizeof(F1UeContextSetupDb));
+   DU_FREE(f1UeDb, sizeof(F1UeContextSetupDb));
+}
+
+/*******************************************************************
+ *
+ * @brief Function to build Am cfg Info
+ *
+ * @details
+ *
+ *    Function : extractRlcAmCfg
+ *
+ *    Functionality: Function to build Am cfg Info
+ *
+ * @params[in] AmBearerCfg *
+ *             void *
+ *
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg)
+{
+   if(rlcAmCfg)
+   {
+      /* UL AM */
+      if(rlcAmCfg->dl_AM_RLC.sn_FieldLength)
+      {
+        amCfgToSet->ulAmCfg.snLenUl = *(rlcAmCfg->dl_AM_RLC.sn_FieldLength);
+        amCfgToSet->ulAmCfg.reAssemTmr = rlcAmCfg->dl_AM_RLC.t_Reassembly;
+        amCfgToSet->ulAmCfg.statProhTmr = rlcAmCfg->dl_AM_RLC.t_StatusProhibit;
+      }
+
+      /* DL AM */
+      if(rlcAmCfg->ul_AM_RLC.sn_FieldLength)
+      {
+        amCfgToSet->dlAmCfg.snLenDl = *(rlcAmCfg->ul_AM_RLC.sn_FieldLength);
+        amCfgToSet->dlAmCfg.pollRetxTmr = rlcAmCfg->ul_AM_RLC.t_PollRetransmit;
+        amCfgToSet->dlAmCfg.pollPdu   = rlcAmCfg->ul_AM_RLC.pollPDU;
+        amCfgToSet->dlAmCfg.pollByte  = rlcAmCfg->ul_AM_RLC.pollByte;
+        amCfgToSet->dlAmCfg.maxRetxTh = rlcAmCfg->ul_AM_RLC.maxRetxThreshold;
+      }
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to build Um Bi Info
+ *
+ * @details
+ *
+ *    Function : extractRlcUmBiCfg
+ *
+ *    Functionality: Function to build Um Bi Info
+ *
+ * @params[in] UmBiDirBearerCfg *
+ *             void *
+ *
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+void extractRlcUmBiCfg(UmBiDirBearerCfg *umBiCfgToSet, struct RLC_Config__um_Bi_Directional *rlcBiCfg)
+{
+   if(rlcBiCfg)
+   {
+      /* UL UM BI DIR Cfg */
+      if(rlcBiCfg->dl_UM_RLC.sn_FieldLength)
+      {
+        umBiCfgToSet->ulUmCfg.snLenUlUm  = *(rlcBiCfg->dl_UM_RLC.sn_FieldLength);
+        umBiCfgToSet->ulUmCfg.reAssemTmr = rlcBiCfg->dl_UM_RLC.t_Reassembly;
+      }
+
+      /* DL UM BI DIR Cfg */
+      if(rlcBiCfg->ul_UM_RLC.sn_FieldLength)
+        umBiCfgToSet->dlUmCfg.snLenDlUm  = *(rlcBiCfg->ul_UM_RLC.sn_FieldLength);
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to build Um Ul Info
+ *
+ * @details
+ *
+ *    Function : extractRlcUmUlCfg
+ *
+ *    Functionality: Function to build Um Ul Info
+ *
+ * @params[in] UmUniDirUlBearerCfg *
  *             void *
  *
  * @return ROK/RFAILED
@@ -7565,26 +8188,381 @@ uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg
       /* Fill SpCell Reconfig */
       if(cellGrp->spCellConfig)
       {
-         spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig));  
-         if(spcellCfg->servCellIndex)
-        {
-            macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex);
-        }
-         /* Fill Serving cell Reconfig info */
-        if(cellGrp->spCellConfig->spCellConfigDedicated)
+         spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig));  
+         if(spcellCfg->servCellIndex)
+        {
+            macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex);
+        }
+         /* Fill Serving cell Reconfig info */
+        if(cellGrp->spCellConfig->spCellConfigDedicated)
+        {
+           servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
+            ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg);
+           if(ret == RFAILED)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
+           }
+        }
+      }
+   }
+   return ret;
+}
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details
+*
+*    Function : freeAperDecodeNrcgi 
+*
+*    Functionality: Free Nrcgi values
+*
+* @params[in] NRCGI_t *nrcgi
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeNrcgi(NRCGI_t *nrcgi)
+{
+    if(nrcgi->pLMN_Identity.buf != NULLP)
+    {
+       free(nrcgi->pLMN_Identity.buf);
+    }
+    if(nrcgi->nRCellIdentity.buf != NULLP)
+    {
+       free(nrcgi->nRCellIdentity.buf);
+    }
+}
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details
+*
+*    Function : freeAperDecodeCuToDuInfo 
+*
+*    Functionality:  Free Cu To Du Information
+*
+* @params[in] CUtoDURRCInformation_t *rrcMsg
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeCuToDuInfo(CUtoDURRCInformation_t *rrcMsg)
+{
+   uint8_t ieIdx =0;
+   uint8_t arrIdx =0;
+
+   if(rrcMsg->uE_CapabilityRAT_ContainerList)
+   {
+      if(rrcMsg->uE_CapabilityRAT_ContainerList->buf)
+         free(rrcMsg->uE_CapabilityRAT_ContainerList->buf);
+      free(rrcMsg->uE_CapabilityRAT_ContainerList);
+   }
+
+   if(rrcMsg->iE_Extensions)
+   {
+      if(rrcMsg->iE_Extensions->list.array)
+      {
+        for(ieIdx= 0; ieIdx < rrcMsg->iE_Extensions->list.count; ieIdx++)
+        {
+           if(rrcMsg->iE_Extensions->list.array[ieIdx])
+           {
+              switch(rrcMsg->iE_Extensions->list.array[ieIdx]->id)
+              {
+                 case ProtocolIE_ID_id_CellGroupConfig:
+                    if(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf != NULLP)
+                    {
+                       free(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf);
+                    }
+                    break;
+                 default:
+                    DU_LOG("\nF1AP:Invalid Event type %ld at FreeCuToDuInfo()", \
+                          rrcMsg->iE_Extensions->list.array[ieIdx]->id);
+                    break;
+              }
+           }
+        }
+        for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
+        {
+           free(rrcMsg->iE_Extensions->list.array[arrIdx]);
+        }
+        free(rrcMsg->iE_Extensions->list.array);
+
+      }
+
+      free(rrcMsg->iE_Extensions);
+   }
+}
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details 
+*
+*    Function : freeAperDecodeSplCellList
+*
+*    Functionality: Free Spl Cell List 
+                    where memory allocated by aper_decoder
+*
+* @params[in]  SCell_ToBeSetup_List_t *spCellLst
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeSplCellList(SCell_ToBeSetup_List_t *spCellLst)
+{
+    uint8_t  cellIdx =0;
+
+    if(spCellLst->list.array != NULLP)
+    {
+       for(cellIdx=0; cellIdx<spCellLst->list.count; cellIdx++)
+       {
+          if(cellIdx==0&&spCellLst->list.array[cellIdx]!=NULLP)
+          {
+             freeAperDecodeNrcgi(&spCellLst->list.array[cellIdx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
+          }
+          if(spCellLst->list.array[cellIdx]!=NULLP)
+          {
+             free(spCellLst->list.array[cellIdx]);
+          }
+       }
+       free(spCellLst->list.array);
+    }
+}
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details
+*
+*    Function : freeAperDecodeSRBSetup 
+*
+*    Functionality: added free part for the memory allocated by aper_decoder
+*
+* @params[in] SRBs_ToBeSetup_List_t *srbSet
+* @return void
+*
+****************************************************************/
+
+
+void freeAperDecodeSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
+{
+    uint8_t srbIdx =0;
+    if(srbSet->list.array != NULLP)
+    {
+       for(srbIdx=0; srbIdx<srbSet->list.count; srbIdx++)
+       {
+          if(srbSet->list.array[srbIdx]!=NULLP)
+          {
+             free(srbSet->list.array[srbIdx]);
+          }
+       }
+       free(srbSet->list.array);
+    }
+}
+
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details
+*
+*    Function : freeAperDecodeULTnlInfo
+*
+*    Functionality: added free part for the memory allocated by aper_decoder
+*
+* @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
+{
+   uint8_t ulIdx=0;
+   if(ulInfo->list.array != NULLP)
+   {
+      for(ulIdx=0; ulIdx<ulInfo->list.count; ulIdx++)
+      {
+        if(ulIdx==0&&ulInfo->list.array[ulIdx]!=NULLP)
+        {
+           if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel!=NULLP)
+           {
+              if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+                    transportLayerAddress.buf != NULLP)
+              {
+                 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
+                       !=NULLP)
+                 {
+                    free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf);
+                 }
+                 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+                       transportLayerAddress.buf);
+              }
+              free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel);
+           }
+        }
+        if(ulInfo->list.array[ulIdx]!=NULLP)
+        {
+           free(ulInfo->list.array[ulIdx]);
+        }
+      }
+      free(ulInfo->list.array);
+   }
+}
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details
+*
+*    Function : freeAperDecodeDRBSetup  
+*
+*    Functionality: free DRBSetup which is allocated by decoder
+*
+* @params[in]  DRBs_ToBeSetup_List_t *drbSet
+* @return void
+*
+* ****************************************************************/
+
+void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
+{
+   DRBs_ToBeSetup_Item_t *drbSetItem = NULLP;
+   uint8_t  flowIdx =0;
+   uint8_t  drbIdx =0;
+   
+   if(drbSet->list.array != NULLP)
+   {
+      for(drbIdx=0; drbIdx<drbSet->list.count; drbIdx++)
+      {
+        if(drbIdx==0&&drbSet->list.array[drbIdx] != NULLP)
         {
-           servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
-            ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg);
-           if(ret == RFAILED)
+           drbSetItem =&drbSet->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
+           if(drbSetItem->qoSInformation.choice.choice_extension != NULLP)
            {
-              DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
+              if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                    qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP)
+              {
+                 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                       qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
+                 {
+                    if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                          qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
+                    {
+
+                       if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP)
+                       {
+
+                          if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP)
+                          {
+
+                             if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->\
+                             buf!=NULLP)
+                             {
+
+                                if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
+                                      flows_Mapped_To_DRB_List.list.array != NULLP)
+                                {
+
+                                   for(flowIdx=0;flowIdx<drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                   DRB_Information.flows_Mapped_To_DRB_List.list.count; flowIdx++)
+                                   {
+
+                                      if(flowIdx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                            DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
+                                      {
+                                         if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                               DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                               qoSFlowLevelQoSParameters.\
+                                               qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP)
+                                         {
+                                            if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                                  DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                                  qoSFlowLevelQoSParameters.\
+                                                  qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
+                                            {
+
+                                               if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                                     DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                                     qoSFlowLevelQoSParameters.\
+                                                     qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
+                                               {
+                                                  freeAperDecodeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
+                                                  free(drbSetItem->uLConfiguration);
+
+
+                                                  free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                                        DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                                        qoSFlowLevelQoSParameters.\
+                                                        qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
+                                               }
+
+                                               free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                                     DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                                     qoSFlowLevelQoSParameters.\
+                                                     qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
+                                            }
+
+                                            free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+
+                                                  DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                                  qoSFlowLevelQoSParameters.\
+                                                  qoS_Characteristics.choice.non_Dynamic_5QI);
+                                         }
+                                      }
+                                      if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                            DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
+                                      {
+
+                                         free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                               DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]);
+                                      }
+                                   }
+
+                                   free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                         DRB_Information.flows_Mapped_To_DRB_List.list.array);
+                                }
+
+                                free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                DRB_Information.sNSSAI.sD->buf);
+                             }
+
+                             free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD);
+                          }
+
+                          free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf);
+
+                       }
+
+                       free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+
+                             qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
+                    }
+
+                    free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                          qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
+                 }
+
+                 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                       qoS_Characteristics.choice.non_Dynamic_5QI);
+              }
+              free(drbSetItem->qoSInformation.choice.choice_extension);
            }
         }
+        if(drbSet->list.array[drbIdx]!=NULLP)
+        {
+           free(drbSet->list.array[drbIdx]);
+        }
       }
+      free(drbSet->list.array);
    }
-   return ret;
 }
 
+
 /*******************************************************************
  *
  * @brief builds Mac Cell Cfg
@@ -7749,9 +8727,9 @@ void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap)
 CellGroupConfigRrc_t *extractCellGrpInfo(ProtocolExtensionContainer_4624P16_t *protocolIeExtn,\
    DuUeCfg *ueCfgDb)
 {
-   uint8_t idx2;
-   uint16_t id;
-   uint16_t recvBufLen;
+   uint8_t idx2 =0;
+   uint16_t id =0;
+   uint16_t recvBufLen =0;
    CellGroupConfigRrc_t *cellGrpCfg = NULLP;
    CUtoDURRCInformation_ExtIEs_t *extIeInfo = NULLP;
    asn_dec_rval_t rval; /* Decoder return value */
@@ -8066,7 +9044,6 @@ UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapa
    xer_fprint(stdout, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, ueCapRatContList);
 
    /* Free encoded buffer after decoding */
-   free(ueCapablityListBuf->buf);
 
    for(idx = 0; idx < ueCapRatContList->list.count; idx++)
    {
@@ -8103,7 +9080,90 @@ UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapa
    DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
    return ueNrCap;
 }
+/*******************************************************************
+*
+* @brief free UE context setup request from CU
+*
+* @details
+*
+*    Function : freeAperDecodeF1UeContextSetupReq
+*
+*    Functionality: freeing part for the memory allocated by aper_decoder
+*
+* @params[in] F1AP message
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t   *ueSetReq)
+{
+   uint8_t ieIdx = 0;
+
+   if(ueSetReq->protocolIEs.list.array != NULLP)
+   {
+      for(ieIdx = 0; ieIdx < ueSetReq->protocolIEs.list.count; ieIdx++)
+      {
+        if(ueSetReq->protocolIEs.list.array[ieIdx])
+        {
+           switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
+           {
+              case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                 break;
+              case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                 break;
+              case ProtocolIE_ID_id_SpCell_ID:
+                 freeAperDecodeNrcgi(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
+                 break;
+              case ProtocolIE_ID_id_ServCellIndex:
+                 break;
+              case ProtocolIE_ID_id_SpCellULConfigured:
+                 break;
+              case ProtocolIE_ID_id_CUtoDURRCInformation:
+
+                 freeAperDecodeCuToDuInfo(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation);
+                 break;
+              case ProtocolIE_ID_id_SCell_ToBeSetup_List:
+
+                 freeAperDecodeSplCellList(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SCell_ToBeSetup_List);
+                 break;
+              case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
+
+                 freeAperDecodeSRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List);
+                 break;
+              case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
+
+                 freeAperDecodeDRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List);
+                 break;
+              case ProtocolIE_ID_id_RRCContainer:
+                 {
+
+                    if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf != NULLP)
+                    {
 
+                       free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf);
+                    }
+                    break;
+                 }
+              case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
+                 break;
+              case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
+                 {
+                    if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf)
+                    {
+                       free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf);
+                    }
+                    break;
+                 }
+              default:
+                 printf("\nF1AP: Invalid event type %ld",ueSetReq->protocolIEs.list.array[ieIdx]->id);
+           } 
+           free(ueSetReq->protocolIEs.list.array[ieIdx]);
+        }
+      }
+      free(ueSetReq->protocolIEs.list.array);
+   }
+}
 /*******************************************************************
  *
  * @brief Process UE context setup request from CU
@@ -8121,7 +9181,7 @@ UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapa
  * ****************************************************************/
 uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
 {
-   uint8_t    ret, ieIdx, ueIdx, lcId, cellIdx;
+   uint8_t  ret, ieIdx, ueIdx, lcId, cellIdx;
    bool ueCbFound = false;
    uint32_t gnbCuUeF1apId, gnbDuUeF1apId, bitRateSize;
    DuUeCb   *duUeCb = NULLP;
@@ -8304,7 +9364,8 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
    }
    else
       ret = duProcUeContextSetupRequest(duUeCb);
-
+   
+   freeAperDecodeF1UeContextSetupReq(ueSetReq); 
    return ret;
 
 }
@@ -8598,8 +9659,21 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId)
    FreeUeContextSetupRsp(f1apMsg);
    return ret;
 }/* End of BuildAndSendUeContextSetupRsp */
+/*******************************************************************
+*
+* @brief  Build And Send Ue Context Rsp 
+*
+* @details
+*
+*    Function : BuildAndSendUeCtxtRsp 
+*
+*    Functionality : Build And Send Ue Context Rsp
 
-
+* @params[in]
+* @return sucess = ROK
+*         failure = RFAILED
+*
+* ****************************************************************/
 uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId)
 {
    uint8_t cellIdx = 0, actionType = 0; 
@@ -8942,6 +10016,36 @@ uint8_t BuildAndSendF1ResetAck()
    FreeF1ResetAck(f1apMsg);
    return ret;
 }
+/******************************************************************
+*
+* @brief free F1 reset msg allocated by aper_decoder 
+*
+* @details
+*
+*    Function : freeAperDecodeF1ResetMsg 
+*
+*    Functionality: free F1 reset msg allocated by aper_decoder 
+*
+* @params[in] Reset_t *f1ResetMsg 
+* @return void 
+*
+* ****************************************************************/
+
+void freeAperDecodeF1ResetMsg(Reset_t *f1ResetMsg)
+{
+   uint8_t ieIdx =0;
+   if(f1ResetMsg->protocolIEs.list.array)
+   {
+      for(ieIdx=0 ;ieIdx < f1ResetMsg->protocolIEs.list.count ; ieIdx++)
+      {
+        if(f1ResetMsg->protocolIEs.list.array[ieIdx])
+        {
+           free(f1ResetMsg->protocolIEs.list.array[ieIdx]);
+        }
+      }
+      free(f1ResetMsg->protocolIEs.list.array);
+   }
+}
 
 /******************************************************************
  *
@@ -8961,16 +10065,16 @@ uint8_t BuildAndSendF1ResetAck()
 uint8_t procF1ResetReq(F1AP_PDU_t *f1apMsg)
 {
    /* we are currently not supporting Ue release. right now we are supporting only init case of fireset */
-   uint8_t       idx = 0;
+   uint8_t       ieIdx = 0;
    uint8_t        ret = ROK;
    Reset_t       *f1ResetMsg = NULLP;
 
    DU_LOG("\nProcessing F1 reset request");
    f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
 
-   for(idx=0; idx<f1ResetMsg->protocolIEs.list.count; idx++)
+   for(ieIdx=0; ieIdx<f1ResetMsg->protocolIEs.list.count; ieIdx++)
    {
-      switch(f1ResetMsg->protocolIEs.list.array[idx]->id)
+      switch(f1ResetMsg->protocolIEs.list.array[ieIdx]->id)
       {
         case ProtocolIE_ID_id_TransactionID:
            break;
@@ -8990,6 +10094,9 @@ uint8_t procF1ResetReq(F1AP_PDU_t *f1apMsg)
    }
    ret = BuildAndSendF1ResetAck();
    DU_LOG("\nUE release is not supported for now");
+
+   freeAperDecodeF1ResetMsg(f1ResetMsg);
+
    return ret;
 }
 
@@ -9215,7 +10322,116 @@ uint8_t extractCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
    }
    return ret;
 }
+/******************************************************************
+*
+* @brief Processes F1 Setup Response allocated by aper_decoder 
+*
+* @details
+*
+*    Function : freeF1SetupRsp 
+*
+*    Functionality: free F1 Setup Response allocated by aper_decoder 
+*
+* @params[in] F1SetupResponse_t *f1SetRspMsg 
+* @return void 
+*
+* ****************************************************************/
+
+void freeAperDecodeF1SetupRsp(F1SetupResponse_t *f1SetRspMsg)
+{
+   uint8_t ieIdx =0;
+   uint8_t arrIdx =0;
+   Cells_to_be_Activated_List_t *cellToActivate =NULLP;
+   RRC_Version_t      *rrcVer =NULLP;
+
+   if(f1SetRspMsg->protocolIEs.list.array)
+   {
+      for(ieIdx=0; ieIdx<f1SetRspMsg->protocolIEs.list.count; ieIdx++)
+      {
+        if(f1SetRspMsg->protocolIEs.list.array[ieIdx])
+        {
+           switch(f1SetRspMsg->protocolIEs.list.array[ieIdx]->id)
+           {
+              case ProtocolIE_ID_id_Cells_to_be_Activated_List:
+                 {
+                    cellToActivate =
+                       &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.Cells_to_be_Activated_List;
+                    if(cellToActivate->list.array)
+                    {
+                       for(arrIdx=0; arrIdx<cellToActivate->list.count ; arrIdx++)
+                       {
+                          if(cellToActivate->list.array[arrIdx])
+                          {
+
+                             if(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.nRCGI.\
+                             pLMN_Identity.buf)
+                             {
+                                if(cellToActivate->list.array[0]->value.choice.\
+                                      Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf)
+                                {
+                                   free(cellToActivate->list.array[0]->value.choice.\
+                                         Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf);
+                                }
+
+                                free(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.\
+                                      nRCGI.pLMN_Identity.buf);
+                             }
+                             free(cellToActivate->list.array[arrIdx]);
+                          }
+                       }
+                       free(cellToActivate->list.array);
+                    }
+                    break;
+                 }
+              case ProtocolIE_ID_id_TransactionID:
+                 {
+                    break;
+                 }
+              case ProtocolIE_ID_id_gNB_CU_Name:
+                 {
+                    free(f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_Name.buf);
+                    break;
+                 }
+              case ProtocolIE_ID_id_GNB_CU_RRC_Version:
+                 {
+                    rrcVer = &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version;
+                    if(rrcVer->latest_RRC_Version.buf)
+                    {
+                       if(rrcVer->iE_Extensions)
+                       {
+                          if(rrcVer->iE_Extensions->list.array)
+                          {
+                             if(rrcVer->iE_Extensions->list.array[0])
+                             {
+                                if(rrcVer->iE_Extensions->list.\
+                                      array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf)
+                                {
+                                   free(rrcVer->iE_Extensions->list.\
+                                         array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf);
+                                }
+                                free(rrcVer->iE_Extensions->list.array[0]);
+                             }
+                             free(rrcVer->iE_Extensions->list.array);
+                          }
+                          free(rrcVer->iE_Extensions);
+                       }
+                       free(rrcVer->latest_RRC_Version.buf);
+                    }
+                    break;
 
+                 }
+              default:
+                 {
+                    DU_LOG("\nDU_APP : Invalid IE received in F1SetupRsp:%ld",
+                          f1SetRspMsg->protocolIEs.list.array[ieIdx]->id);
+                 }
+           }
+           free(f1SetRspMsg->protocolIEs.list.array[ieIdx]);
+        }
+      }
+      free(f1SetRspMsg->protocolIEs.list.array);
+   }
+}
 /******************************************************************
  *
  * @brief Processes F1 Setup Response sent by CU
@@ -9234,11 +10450,12 @@ uint8_t extractCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
 uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg)
 {
    uint8_t ret = ROK;
-   uint16_t idx;
+   uint16_t idx =0;
    F1SetupResponse_t *f1SetRspMsg = NULLP;
    GNB_CU_Name_t     *cuName = NULLP;
-   RRC_Version_t     *rrc_Ver = NULLP;
    F1SetupRsp  f1SetRspDb;
+   RRC_Version_t      *rrcVer =NULLP;
+   
    memset(&f1SetRspDb, 0, sizeof(F1SetupRsp));
 
    DU_LOG("\nF1AP : F1 Setup Response received");
@@ -9269,10 +10486,9 @@ uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg)
            }
         case ProtocolIE_ID_id_GNB_CU_RRC_Version:
            {
-              rrc_Ver = &f1SetRspMsg->protocolIEs.list.array[idx]->\
-                        value.choice.RRC_Version;
+              rrcVer = &f1SetRspMsg->protocolIEs.list.array[idx]->value.choice.RRC_Version;
               strcpy(f1SetRspDb.rrcVersion.rrcVer,
-                    (const char*)rrc_Ver->latest_RRC_Version.buf);
+                    (const char*)rrcVer->latest_RRC_Version.buf);
               break;
            }
         default:
@@ -9281,24 +10497,57 @@ uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg)
       }
       duProcF1SetupRsp();
    }
+   
+   freeAperDecodeF1SetupRsp(f1SetRspMsg);
    return ret;
 }
+/*******************************************************************
+*
+* @brief free GNB DU config update ack
+*
+* @details
+*
+*    Function : freeAperDecodeGnbDuAck 
+*
+*    Functionality: Processes GNB DU config update ack And
+*                     added free part for the memory allocated by aper_decoder
+*
+* @params[in] F1AP_PDU_t ASN decoded F1AP message
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+
+void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
+{
+   uint8_t ieIdx = 0;
 
+   if(gnbDuAck->protocolIEs.list.array)
+   {
+      for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
+      {
+        if(gnbDuAck->protocolIEs.list.array[ieIdx])
+        {
+           free(gnbDuAck->protocolIEs.list.array[ieIdx]);
+        }
+      }
+      free(gnbDuAck->protocolIEs.list.array);
+   }
+}
 /*******************************************************************
- *
- * @brief Processes GNB DU config update ack
- *
- * @details
- *
- *    Function : procF1GNBDUCfgUpdAck
- *
- *    Functionality: Processes GNB DU config update ack
- *
- * @params[in] F1AP_PDU_t ASN decoded F1AP message
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
+*
+* @brief Processes GNB DU config update ack
+*
+* @details
+*
+*    Function : procF1GNBDUCfgUpdAck
+*
+*    Functionality: added free part for the memory allocated by aper_decoder
+*
+* @params[in] F1AP_PDU_t *f1apMsg 
+* @return void 
+*
+* ****************************************************************/
 uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
 {
    uint8_t ieIdx, transId;
@@ -9330,9 +10579,62 @@ uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
       return RFAILED;
    }
 #endif
+
+   freeAperDecodeGnbDuAck(gnbDuAck);
    return ROK;
 }
+/******************************************************************
+*
+* @brief free DL RRC Message Transfer allocated by aper_decoder 
+*
+* @details
+*
+*    Function : freeAperDecodef1DlRrcMsg 
+*
+*    Functionality: free DL RRC Message Transfer allocated by aper_decoder 
+*
+* @params[in] DLRRCMessageTransfer_t *f1DlRrcMsg 
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+
+void freeAperDecodef1DlRrcMsg(DLRRCMessageTransfer_t *f1DlRrcMsg)
+{
+   uint8_t ieIdx =0;
+   RRCContainer_t *rrcContainer = NULLP;
 
+   if(f1DlRrcMsg->protocolIEs.list.array)
+   {
+      for(ieIdx=0; ieIdx<f1DlRrcMsg->protocolIEs.list.count; ieIdx++)
+      {
+        if(f1DlRrcMsg->protocolIEs.list.array[ieIdx])
+        {
+           switch(f1DlRrcMsg->protocolIEs.list.array[ieIdx]->id)
+           {
+              case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                 break;
+              case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                 break;
+              case ProtocolIE_ID_id_SRBID:
+                 break;
+              case ProtocolIE_ID_id_RRCContainer:
+                 {
+                    rrcContainer =&f1DlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer;
+                    free(rrcContainer->buf);
+                 }
+              case ProtocolIE_ID_id_ExecuteDuplication:
+                 break;
+              case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
+                 break;
+                 break;
+           }
+           free(f1DlRrcMsg->protocolIEs.list.array[ieIdx]);
+        }
+      }
+      free(f1DlRrcMsg->protocolIEs.list.array);
+   }
+}
 /******************************************************************
  *
  * @brief Processes DL RRC Message Transfer  sent by CU
@@ -9420,6 +10722,8 @@ uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
    }
 
    ret = duProcDlRrcMsg(&dlMsg);
+
+   freeAperDecodef1DlRrcMsg(f1DlRrcMsg);
    return ret;
 }
 
@@ -9442,14 +10746,13 @@ uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
  * ****************************************************************/
 void F1APMsgHdlr(Buffer *mBuf)
 {
-   int i;
-   char *recvBuf;
-   MsgLen copyCnt;
-   MsgLen recvBufLen;
-   F1AP_PDU_t *f1apMsg;
+   int i =0;
+   char *recvBuf =NULLP;
+   MsgLen copyCnt =0;
+   MsgLen recvBufLen =0;
+   F1AP_PDU_t *f1apMsg =NULLP;
    asn_dec_rval_t rval; /* Decoder return value */
    F1AP_PDU_t f1apasnmsg ;
-
    DU_LOG("\nF1AP : Received F1AP message buffer");
    ODU_PRINT_MSG(mBuf, 0,0);
 
@@ -9520,6 +10823,7 @@ void F1APMsgHdlr(Buffer *mBuf)
                     return;
                  }
            }/* End of switch(successfulOutcome) */
+           free(f1apMsg->choice.successfulOutcome);
            break;
         }
       case F1AP_PDU_PR_initiatingMessage:
@@ -9550,6 +10854,7 @@ void F1APMsgHdlr(Buffer *mBuf)
                     return;
                  }
            }/* End of switch(initiatingMessage) */
+           free(f1apMsg->choice.initiatingMessage);
            break;
         }
 
@@ -9558,6 +10863,7 @@ void F1APMsgHdlr(Buffer *mBuf)
            DU_LOG("\nF1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
            return;
         }
+        free(f1apMsg);
 
    }/* End of switch(f1apMsg->present) */
 
index b2321bc..90fe20b 100644 (file)
@@ -343,7 +343,7 @@ uint8_t duProcCfgComplete()
       }
       else
       {
-        uint8_t idx1; 
+        uint8_t idx1=0
         memset(cell, 0, sizeof(DuCellCb));
         cell->cellId = ++cellId;
         memset(&cell->cellInfo.nrEcgi.plmn, 0, sizeof(Plmn));
@@ -1785,11 +1785,12 @@ uint8_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
 uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo)
 {
    DuCellCb *cellCb = NULLP;
-   DuUeCb   ueCb;
+   DuUeCb   ueCb ={0};
   
    if(duGetCellCb(ulRrcMsgInfo->cellId, &cellCb) != ROK)
       return RFAILED;
-   
+   if(ulRrcMsgInfo->ueIdx > 0)
+   {
    ueCb = cellCb->ueCb[ulRrcMsgInfo->ueIdx -1];
 
 
@@ -1798,6 +1799,7 @@ uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo)
 
    DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulRrcMsgInfo->rrcMsg, ulRrcMsgInfo->msgLen);
    DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo));
+   }
    return ROK;
 }
 
index e435cfe..86b96ec 100644 (file)
@@ -761,8 +761,8 @@ uint8_t sctpSockPoll()
  * ****************************************************************/
 uint8_t sctpSend(Buffer *mBuf, uint8_t itfType)
 {
-   uint8_t          ret;
-   MsgLen           len;          /* number of actually sent octets */
+   uint8_t          ret =0;
+   MsgLen           len =0;          /* number of actually sent octets */
    CmInetMemInfo    memInfo;                        
    
    memInfo.region = DU_APP_MEM_REGION;               
index 1001da3..583b6c9 100644 (file)
@@ -1727,17 +1727,17 @@ S16 SAllocateStaticMem()
 S16 ssdInitMem(void)
 {
    /* mt018.201 - added local variable */
-   uint8_t              i;
-   uint16_t             j;
-   uint8_t              k;
-   MtRegCfg       *region;
+   uint8_t              i =0;
+   uint16_t             j =0;
+   uint8_t              k =0;
+   MtRegCfg       *region = NULLP;
    Txt             errMsg[256] = {'\0'};
 #ifdef SS_LOCKLESS_MEMORY
-   CmMmDynRegCb   *dynRegCb;
+   CmMmDynRegCb   *dynRegCb =0;
 #ifdef SS_USE_ICC_MEMORY
 #else
-   CmMmGlobRegCb  *globReg;
-   Size            memSize;
+   CmMmGlobRegCb  *globReg = NULLP;
+   Size            memSize =0;
 #endif
 #endif /* SS_LOCKLESS_MEMORY */
    
@@ -1847,7 +1847,7 @@ S16 ssdInitMem(void)
 #endif /* SS_LOCKLESS_MEMORY */
 
 #ifdef T2K_MEM_LEAK_DBG
-    uint8_t reg; 
+    uint8_t reg =0
     /* Initailize mem leak tool memorys for debguing */
     regMemLeakInfo.numActvRegions=0;
     for(reg=0; reg <SS_MAX_REGS; reg++)
@@ -1881,9 +1881,9 @@ S16 ssdInitMem(void)
 #endif
       if (mtCMMRegCb[i] == NULLP)
       {
-                       sprintf(errMsg,"\n ssdInitMem(): Could not allocated memory \
-                                                               for the Region:%d control block\n",i);
-                       SPrint(errMsg);
+        sprintf(errMsg,"\n ssdInitMem(): Could not allocated memory \
+        for the Region:%d control block\n",i);
+        SPrint(errMsg);
          for (k = 0; k < i; k++)
          {
             cmMmRegDeInit(mtCMMRegCb[k]);
@@ -1899,17 +1899,17 @@ S16 ssdInitMem(void)
       mlock(mtCMMRegCfg[i], sizeof(CmMmRegCfg));
 #endif
       if (mtCMMRegCfg[i] == NULLP)
-               {
-                 for (k = 0; k < i; k++)
-                 {
-                        cmMmRegDeInit(mtCMMRegCb[k]);
-                        free(mtCMMRegCfg[k]->vAddr);
-                        free(mtCMMRegCb[k]);
-                        free(mtCMMRegCfg[k]);
-                 }
-                 free(mtCMMRegCb[i]);
-                 return RFAILED;
-               }
+      {
+        for (k = 0; k < i; k++)
+        {
+           cmMmRegDeInit(mtCMMRegCb[k]);
+           free(mtCMMRegCfg[k]->vAddr);
+           free(mtCMMRegCb[k]);
+           free(mtCMMRegCfg[k]);
+        }
+        free(mtCMMRegCb[i]);
+        return RFAILED;
+      }
 
 
       /* allocate space for the region */
@@ -2016,7 +2016,6 @@ S16 ssdInitMem(void)
    cmInitMemLeakMdl();
 #endif /* SS_MEM_LEAK_STS */
 
-
    return ROK;
 }
 
@@ -4651,7 +4650,7 @@ Void *mtTskHdlr
 Ptr tskPtr                      /* pointer to task entry */
 )
 {
-   S16 ret;
+   S16 ret = ROK;
    SsSTskEntry *sTsk;
 
    /* get out the system task entry from the parameter */
@@ -4712,15 +4711,15 @@ S16 mtTskHdlMsg
 SsSTskEntry *sTsk
 )
 {
-   S16 i;
-   S16 ret;
-   SsIdx idx;
-   SsTTskEntry *tTsk;
-   Buffer *mBuf;
+   S16 i =0;
+   S16 ret =0;
+   SsIdx idx =0;
+   SsTTskEntry *tTsk=NULLP;
+   Buffer *mBuf=NULLP;
 #ifdef SS_PERF
-   Buffer *mBuf2;
+   Buffer *mBuf2=NULLP;
 #endif
-   SsMsgInfo *mInfo;
+   SsMsgInfo *mInfo=NULLP;
    Pst nPst;
 /* mt028.201: modification: multiple procs support related changes */
 #ifndef SS_MULTIPLE_PROCS
@@ -4730,8 +4729,8 @@ SsSTskEntry *sTsk
    /* mt015.301 Initialized the timer activation functions with NULLP */
    PFS16 tmrActvFn = NULLP;
 #else
-   PAIFTMRS16 tmrActvFn;
-   uint16_t procIdIdx;
+   PAIFTMRS16 tmrActvFn =NULLP;
+   uint16_t procIdIdx =0;
 #endif /* SS_MULTIPLE_PROCS */
        /* mt003.301 Modifications */
 #ifdef SS_THREAD_PROFILE
index 0cb2bb3..504f8d1 100644 (file)
@@ -2521,9 +2521,9 @@ MsgLen cnt,                 /* count */
 Buffer *mBuf
 )
 {
-   SsMsgInfo *minfo;
-   Buffer *tmp;
-   MsgLen numBytes;
+   SsMsgInfo *minfo = NULLP;
+   Buffer *tmp = NULLP;
+   MsgLen numBytes =0;
 #ifdef T2K_MEM_LEAK_DBG
    char* file = __FILE__;
    uint32_t line = __LINE__;
@@ -3370,10 +3370,10 @@ Data *dstBuf,               /* destination buffer */
 MsgLen *cCnt
 )
 {
-   Data *cptr;
-   Buffer *tmp;
-   SsMsgInfo *minfo;
-   MsgLen numBytes;
+   Data *cptr = NULLP;
+   Buffer *tmp = NULLP;
+   SsMsgInfo *minfo = NULLP;
+   MsgLen numBytes =0;
 
 #if (ERRCLASS & ERRCLS_INT_PAR)
    /* check source message buffer */
@@ -4146,11 +4146,11 @@ Buffer *buf
 )
 #endif
 {
-   register SsDblk *dptr;
+   register SsDblk *dptr = NULLP;
    /* ss021.103 - Addition to check return value of SFree */
-   S16 ret;
+   S16 ret = ROK;
 #if (defined(SS_USE_ZBC_MEMORY) && defined (TENB_DPDK_BUF))
-   Data  *dpdkBuf;
+   Data  *dpdkBuf = NULLP;
 #endif   
  
  
@@ -5369,22 +5369,22 @@ S16 src,                    /* source id */
 S16 dst                     /* destination id */
 )
 {
-   QLen qlen;               /* queue length */
-       MsgLen mlen;             /* message length */
+   QLen qlen =0;               /* queue length */
+   MsgLen mlen =0;             /* message length */
 /*
  * SDeRegTTsk patch
  */
        /* ss038.103 : 102061 Changed to MsgLen from S16 */
-       MsgLen i;                /* counter */
-       S16 j;                   /* counter */
-   S16 k;                   /* counter */
-   uint8_t data;                 /* data */
+   MsgLen i =0;                /* counter */
+   S16 j =0;                   /* counter */
+   S16 k =0;                   /* counter */
+   uint8_t data =0;                 /* data */
    uint8_t tdata[16] = {0};            /* temporary data */
-   S8 prntBuf[256];         /* print buffer */
-   Buffer *tmp;             /* buffer ptr */
-   Data *cptr;
+   S8 prntBuf[256] ={0};         /* print buffer */
+   Buffer *tmp = NULLP;             /* buffer ptr */
+   Data *cptr =NULLP;
 /* ss012.13: Addition */
-   Data reg;
+   Data reg =0;
 
 
 
@@ -7973,7 +7973,7 @@ S16 SPutSBufDpdk
 Data *ptr                     /* pointer to buffer */
 )
 {
-    S16   ret;
+    S16   ret = ROK;
     uint32_t   flags = 0;
 
     ntl_free(mtGetNtlHdl(), ptr);
index 41b856e..4c71a4e 100644 (file)
@@ -1479,8 +1479,8 @@ SSTskPrior tskPrior,            /* task priority */
 SSTskId *tskId                  /* filled in with system task ID */
 )
 {
-   S16 ret;
-   SsSTskEntry *sTsk;
+   S16 ret = ROK;
+   SsSTskEntry *sTsk = NULLP;
 
 
 
index 21533df..a7176a5 100644 (file)
@@ -338,12 +338,12 @@ uint16_t l1BuildAndSendCrcInd(uint16_t slot, uint16_t sfn)
 uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_t puschPdu)
 {
    uint8_t idx = 0;
-   fapi_rx_data_indication_t *rxDataInd;
-   fapi_pdu_ind_info_t       *pduInfo;
+   fapi_rx_data_indication_t *rxDataInd =NULLP;
+   fapi_pdu_ind_info_t       *pduInfo =NULLP;
    uint8_t  *pdu = NULLP;
    uint16_t byteIdx = 0;
    uint32_t msgLen = 0;
-   MsgType type;
+   MsgType type = 0;
 
    if(!msg3Sent)
    {
@@ -386,7 +386,7 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_
       return RFAILED;
    }
    memset(rxDataInd, 0, sizeof(fapi_rx_data_indication_t));
-
+   
    msgLen = sizeof(fapi_rx_data_indication_t) - sizeof(fapi_msg_t);
    rxDataInd->sfn = sfn;
    rxDataInd->slot = slot;
@@ -409,7 +409,7 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_
       printf("\nPHY_STUB: Memory allocation failed for Rx Data Pdu");
       return RFAILED;
    }
-
+   memset(pduInfo->pduData, 0, pduInfo->pdu_length);
    /* Filling PDU */
    pdu = (uint8_t *)pduInfo->pduData;