[Issue Id-ODUHIGH-457] Fixes related to memory leak 63/8563/2
authorbarveankit <anbarve@radisys.com>
Tue, 14 Jun 2022 12:58:33 +0000 (18:28 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Wed, 15 Jun 2022 09:58:01 +0000 (15:28 +0530)
Signed-off-by: barveankit <anbarve@radisys.com>
Change-Id: If710ea05586e0fa81b1e0e44147d1bc5d0f0cad3
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
src/5gnrmac/mac_ue_mgr.c
src/5gnrsch/sch_slot_ind.c
src/5gnrsch/sch_ue_mgr.c

index 06953b4..c6634bf 100644 (file)
@@ -2071,7 +2071,7 @@ void deleteMacRaCb(uint16_t cellIdx, MacUeCb *ueCb)
       for(tbIdx = 0; tbIdx < raCb->msg4HqInfo.numTb; tbIdx++)
       {
          MAC_FREE(raCb->msg4HqInfo.tbInfo[tbIdx].tb, \
-               raCb->msg4HqInfo.tbInfo[tbIdx].tbSize);
+               raCb->msg4HqInfo.tbInfo[tbIdx].tbSize - TX_PAYLOAD_HDR_LEN);
       }
       memset(raCb, 0, sizeof(MacRaCbInfo));
    }
@@ -2708,10 +2708,10 @@ void deletePucchResourcesCfg(PucchResrcCfg *resrcCfg)
 *
 * @details
 *
-*    Function : MacProcSchUeCfgRsp
+*    Function : MacProcSchUeDeleteRsp 
 *
 *    Functionality:
-*      Processes UE create delete from scheduler
+*      Processes UE delete from scheduler
 *
 * @params[in] Pst : Post structure
 *             schUeDelRsp : Scheduler UE delete respons
@@ -2722,10 +2722,11 @@ void deletePucchResourcesCfg(PucchResrcCfg *resrcCfg)
 
 uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp)
 {
-   uint8_t ueId =0, isCrntiValid = 0;
+   uint8_t ueId =0, isCrntiValid = 0, tbIdx =0, idx=0;
    uint16_t cellIdx=0;
    uint8_t ret = RFAILED;
    UeDeleteStatus result;
+   DlHarqEnt  *dlHarqEnt;
 
 #ifdef CALL_FLOW_DEBUG_LOG
    DU_LOG("\nCall Flow: ENTSCH -> ENTMAC : EVENT_UE_DELETE_RSP_TO_MAC\n");
@@ -2764,6 +2765,18 @@ uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp)
                      MAC_FREE(macCb.macCell[cellIdx]->ueCb[ueId -1].dlInfo.lcCb[lcIdx].snssai, sizeof(Snssai));
                   }
 #endif
+                  dlHarqEnt = &macCb.macCell[cellIdx]->ueCb[ueId -1].dlInfo.dlHarqEnt;
+                  for(idx =0 ; idx<MAX_NUM_HARQ_PROC; idx++)
+                  {
+                     tbIdx = 0;
+                     while(dlHarqEnt->harqProcCb[idx].numTb)
+                     {
+
+                        MAC_FREE(dlHarqEnt->harqProcCb[idx].tbInfo[tbIdx].tb, dlHarqEnt->harqProcCb[idx].tbInfo[tbIdx].tbSize);
+                        dlHarqEnt->harqProcCb[idx].numTb--;
+                        tbIdx++;
+                     }
+                  }
                   memset(&macCb.macCell[cellIdx]->ueCb[ueId -1], 0, sizeof(MacUeCb));
                   macCb.macCell[cellIdx]->numActvUe--;
                   result = SUCCESS;
index 7c08cf3..12a387c 100644 (file)
@@ -772,7 +772,8 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst)
    SchCellCb      *cell = NULLP;
    CmLList        *node;
    uint8_t*       ueNode;
-   SchDlHqProcCb  *hqP = NULLP, *ulHqP = NULLP;
+   SchDlHqProcCb  *hqP = NULLP;
+   SchUlHqProcCb *ulHqP = NULLP;
 
    memset(&dlSchedInfo, 0, sizeof(DlSchedInfo));
    schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue);
index 8ca3bac..2dcbee0 100644 (file)
@@ -1069,12 +1069,39 @@ void deleteSchPdschServCellCfg(SchPdschServCellCfg *pdschServCellCfg)
 * ****************************************************************/
 void deleteSchUeCb(SchUeCb *ueCb) 
 {
-   uint8_t timeDomRsrcIdx = 0, ueLcIdx = 0;
+   uint8_t timeDomRsrcIdx = 0, ueLcIdx = 0, idx =0;
    SchPucchCfg *pucchCfg = NULLP;
    SchPdschConfig *pdschCfg = NULLP;
+   CmLList *node = NULLP, *next = NULLP;
 
    if(ueCb)
    {
+      if(ueCb->hqDlmap)
+      {
+         for (idx = 0; idx<ueCb->cellCb->numSlots; idx++)
+         {
+            if(ueCb->hqDlmap[idx])
+            {
+               cmLListDeleteLList(&ueCb->hqDlmap[idx]->hqList);
+               SCH_FREE(ueCb->hqDlmap[idx], sizeof(SchHqDlMap));
+            }
+         }
+         SCH_FREE(ueCb->hqDlmap, sizeof(SchHqDlMap*)*(ueCb->cellCb->numSlots));
+      }
+
+      if(ueCb->hqUlmap)
+      {
+         for (idx = 0; idx<ueCb->cellCb->numSlots; idx++)
+         {
+            if(ueCb->hqUlmap[idx])
+            {
+               cmLListDeleteLList(&ueCb->hqUlmap[idx]->hqList);
+               SCH_FREE(ueCb->hqUlmap[idx], sizeof(SchHqUlMap));
+            }
+         }
+         SCH_FREE(ueCb->hqUlmap, sizeof(SchHqUlMap*)*(ueCb->cellCb->numSlots));
+      }
+
       SCH_FREE(ueCb->ueCfg.ambrCfg, sizeof(SchAmbrCfg));
       if(ueCb->ueCfg.spCellCfgPres)
       {