Fix for segmentation fault in CLA [Issue-ID: ODUHIGH-348]
[o-du/l2.git] / src / 5gnrsch / sch_ue_mgr.c
index a3a0c55..a27c3e4 100644 (file)
@@ -234,12 +234,8 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg)
       ueCb->ueCfg.spCellCfgPres = true;
    }
    ueCb->state = SCH_UE_STATE_ACTIVE;
-   if(ueCfg->ambrCfg != NULLP)
-   {
-      SCH_ALLOC(ueCb->ueCfg.ambrCfg , sizeof(SchAmbrCfg));
-      memcpy(&ueCb->ueCfg.ambrCfg->ulBr , &ueCfg->ambrCfg->ulBr, sizeof(SchAmbrCfg));
-   }
    
+   ueCb->ueCfg.ambrCfg =  ueCfg->ambrCfg;
    memcpy(&ueCb->ueCfg.dlModInfo,  &ueCfg->dlModInfo , sizeof(SchModulationInfo));
    memcpy(&ueCb->ueCfg.ulModInfo,  &ueCfg->ulModInfo , sizeof(SchModulationInfo));
 
@@ -422,13 +418,12 @@ uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, S
   uint16_t puschSlot      = 0;
   uint16_t startRb        = 0;
   uint8_t  numRb          = 0;
-  uint8_t  numPdschSymbols= 14;
   uint16_t tbSize         = 0;
   uint8_t  buffer         = 5;
   uint8_t  idx            = 0;
   SchCellCb *cellCb       = ueCb->cellCb;
   SchUlSlotInfo *schUlSlotInfo = NULLP;
-  uint8_t k2=0, startSymb=0 , symbLen=0;
+  uint8_t k2=0, startSymb=0 , symbLen=11;
   
   if(ueCb->ueCfg.spCellCfgPres == true)
   {
@@ -440,7 +435,7 @@ uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, S
 
   startRb = cellCb->schUlSlotInfo[puschSlot]->puschCurrentPrb;
   tbSize  = schCalcTbSize(dataVol + buffer); /*  2 bytes header + some buffer */
-  numRb   = schCalcNumPrb(tbSize, ueCb->ueCfg.ulModInfo.mcsIndex, numPdschSymbols);
+  numRb   = schCalcNumPrb(tbSize, ueCb->ueCfg.ulModInfo.mcsIndex, symbLen);
   /* increment PUSCH PRB */
 
   cellCb->schUlSlotInfo[puschSlot]->puschCurrentPrb += numRb;
@@ -918,17 +913,10 @@ void deleteSchCellCb(SchCellCb *cellCb)
       {
          if(cellCb->schDlSlotInfo[idx])
          {
-            SCH_FREE(cellCb->schDlSlotInfo[idx]->rarInfo, sizeof(RarInfo));
-            if(cellCb->schDlSlotInfo[idx]->dlMsgInfo)
-            {
-               SCH_FREE(cellCb->schDlSlotInfo[idx]->dlMsgInfo->dlMsgPdu,\
-                     cellCb->schDlSlotInfo[idx]->dlMsgInfo->dlMsgPduLen);
-               SCH_FREE(cellCb->schDlSlotInfo[idx]->dlMsgInfo, sizeof(DlMsgInfo));
-            }
             SCH_FREE(cellCb->schDlSlotInfo[idx], sizeof(SchDlSlotInfo));
          }
       }
-      SCH_FREE(cellCb->schDlSlotInfo, sizeof(SchDlSlotInfo));
+      SCH_FREE(cellCb->schDlSlotInfo, cellCb->numSlots *sizeof(SchDlSlotInfo*));
    }
    if(cellCb->schUlSlotInfo)
    {
@@ -936,14 +924,13 @@ void deleteSchCellCb(SchCellCb *cellCb)
       {
          if(cellCb->schUlSlotInfo[idx])
          {
-            SCH_FREE(cellCb->schUlSlotInfo[idx]->schPuschInfo,sizeof(SchPuschInfo));
             SCH_FREE(cellCb->schUlSlotInfo[idx], sizeof(SchUlSlotInfo));  
          }
       }
-      SCH_FREE(cellCb->schUlSlotInfo, sizeof(SchUlSlotInfo));
+      SCH_FREE(cellCb->schUlSlotInfo,  cellCb->numSlots * sizeof(SchUlSlotInfo*));
    }
-   SCH_FREE(cellCb->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg, sizeof(PdschCfg));
    memset(cellCb, 0, sizeof(SchCellCb));
+
 }
 
 /*******************************************************************