From: pborla Date: Wed, 20 Mar 2024 15:43:22 +0000 (+0530) Subject: [Epic-ID: ODUHIGH-538][Issue-ID: ODUHIGH-575] Deallocating the variables allocated... X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F22%2F12622%2F2;p=o-du%2Fl2.git [Epic-ID: ODUHIGH-538][Issue-ID: ODUHIGH-575] Deallocating the variables allocated in parseDuCfgParams Change-Id: Ib721ef8c70171a46518975bca41cad9a380b9b3d Signed-off-by: pborla --- diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index dac40baef..bfac69cbd 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -778,6 +778,7 @@ void freeMacSliceCfgReq(MacSliceCfgReq *cfgReq,Pst *pst) MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfRrmPolicy, cfgReq->numOfRrmPolicy * sizeof(MacSliceRrmPolicy*)); } } + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq, sizeof(MacSliceCfgReq)); } diff --git a/src/5gnrsch/sch_utils.c b/src/5gnrsch/sch_utils.c index aeb8bdd03..3e8b23afd 100644 --- a/src/5gnrsch/sch_utils.c +++ b/src/5gnrsch/sch_utils.c @@ -2116,12 +2116,14 @@ uint32_t schCalY(uint8_t csId, uint32_t prevY) uint8_t schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo) { uint8_t slotIdx = 0; - - SCH_ALLOC(pdcchInfo->y, (sizeof(uint32_t) * ueCb->cellCb->numSlots)); if(pdcchInfo->y == NULLP) { - DU_LOG("\nERROR --> SCH: Memory Allocation of Y failed"); - return RFAILED; + SCH_ALLOC(pdcchInfo->y, (sizeof(uint32_t) * ueCb->cellCb->numSlots)); + if(pdcchInfo->y == NULLP) + { + DU_LOG("\nERROR --> SCH: Memory Allocation of Y failed"); + return RFAILED; + } } for(slotIdx= 0 ; slotIdx < ueCb->cellCb->numSlots; slotIdx++) diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c index f09225b0f..947014d2a 100644 --- a/src/du_app/du_cell_mgr.c +++ b/src/du_app/du_cell_mgr.c @@ -437,7 +437,6 @@ uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp) duCb.numActvCells--; duCb.numCfgCells--; DU_FREE(duCb.actvCellLst[cellIdx], sizeof(DuCellCb)); - } else { diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index 1ddbd0180..ed8a5fd17 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -5001,6 +5001,149 @@ uint8_t parseGlobalConfigParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) return ROK; } +/******************************************************************* + * + * @brief Free the memory allocate for slice supported list + * + * @details + * + * Function : parseDuCfgParams + * + * Functionality: Free the memory allocate for slice supported list + * + * @return void + * + * ****************************************************************/ +void freeSliceSuppLst(SupportedSliceList *sliceSuppLst) +{ + uint8_t sliceIdx=0; + + if(sliceSuppLst->numSupportedSlices&&sliceSuppLst->snssai) + { + for(sliceIdx=0;sliceIdxnumSupportedSlices;sliceIdx++) + { + if(sliceSuppLst->snssai) + { + if(sliceSuppLst->snssai[sliceIdx]) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, sliceSuppLst->snssai[sliceIdx], sizeof(Snssai)); + } + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, \ + sliceSuppLst->snssai, (sliceSuppLst->numSupportedSlices) * sizeof(Snssai*)); + } + } + } +} + +/******************************************************************* + * + * @brief Free the memory allocate in parseDuCfgParams + * + * @details + * + * Function : parseDuCfgParams + * + * Functionality: Free the memory allocate in parseDuCfgParams + * + * @return void + * + * ****************************************************************/ +void freeDuCfgParams() +{ + uint8_t ranFuncIdx=0,reportStyleIdx=0; + uint8_t policyIdx = 0,memIdx=0; + MacSliceRrmPolicy *rrmPolicy =NULLP; + MacSliceCfgReq *macSliceCfgReq=NULLP; + F1DuSysInfo *sysInfo; + CsiRsCfg *csiRsCfg; + RanFunction *ranFunction; + RicReportStyle *ricReportStyle; + CmLListCp *measurementInfoList; + CmLList *measInfoNode = NULLP; + + if(duCfgParam.duName) + { + DU_FREE(duCfgParam.duName, strlen(duCfgParam.duName)); + } + + freeSliceSuppLst(&duCfgParam.macCellCfg.cellCfg.plmnInfoList[0].suppSliceList); + csiRsCfg=&duCfgParam.macCellCfg.csiRsCfg; + if(csiRsCfg->csiFreqDomainAlloc) + { + DU_FREE(csiRsCfg->csiFreqDomainAlloc, sizeof(uint8_t)); + } + if(duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, \ + duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu, duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1PduLen); + } + + if(duCb.e2apDb.numOfRanFunction) + { + for(ranFuncIdx=0;ranFuncIdxnumOfReportStyleSupported;reportStyleIdx++) + { + ricReportStyle=&ranFunction->reportStyleList[reportStyleIdx]; + measurementInfoList=&ricReportStyle->measurementInfoList; + CM_LLIST_FIRST_NODE(measurementInfoList, measInfoNode); + while(measInfoNode) + { + MeasurementInfoForAction *measurementInfoForAction; + measurementInfoForAction= (MeasurementInfoForAction*)measInfoNode->node; + cmLListDelFrm(measurementInfoList, measInfoNode); + DU_FREE(measurementInfoForAction, sizeof(MeasurementInfoForAction)); + DU_FREE(measInfoNode, sizeof(CmLList)); + CM_LLIST_FIRST_NODE(measurementInfoList, measInfoNode); + } + } + } + } + + freeSliceSuppLst(&duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst); + sysInfo=&duCfgParam.srvdCellLst[0].duSysInfo; + if(sysInfo->mibMsg) + { + DU_FREE(sysInfo->mibMsg, sysInfo->mibLen); + } + if(sysInfo->sib1Msg) + { + DU_FREE(sysInfo->sib1Msg, sysInfo->sib1Len); + } + + macSliceCfgReq=&duCfgParam.tempSliceCfg; + if(macSliceCfgReq->listOfRrmPolicy) + { + for(policyIdx = 0; policyIdx < macSliceCfgReq->numOfRrmPolicy; policyIdx++) + { + if (macSliceCfgReq->listOfRrmPolicy[policyIdx]) + { + rrmPolicy=macSliceCfgReq->listOfRrmPolicy[policyIdx]; + if(rrmPolicy->rRMPolicyMemberList) + { + for(memIdx = 0; memIdx < rrmPolicy->numOfRrmPolicyMem; memIdx++) + { + if (rrmPolicy->rRMPolicyMemberList[memIdx]) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\ + rrmPolicy->rRMPolicyMemberList[memIdx], sizeof(RrmPolicyMemberList)); + } + } + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,rrmPolicy->rRMPolicyMemberList,\ + rrmPolicy->numOfRrmPolicyMem * sizeof(RrmPolicyMemberList*)); + } + + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, \ + macSliceCfgReq->listOfRrmPolicy[policyIdx], sizeof(MacSliceRrmPolicy)); + } + } + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, \ + macSliceCfgReq->listOfRrmPolicy, macSliceCfgReq->numOfRrmPolicy * sizeof(MacSliceRrmPolicy*)); + } +} + + /******************************************************************* * * @brief Fill DU Config Parmeters @@ -5020,6 +5163,7 @@ uint8_t parseGlobalConfigParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) * ****************************************************************/ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) { + uint8_t ret=ROK; char *tempDuName = ""; char *duIpV4Addr; char *cuIpV4Addr; @@ -5036,7 +5180,8 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) #ifdef THREAD_AFFINITY if(parseThreadAffinity(doc, ns, cur, &duCfgParam.threadInfo) != ROK) { - return RFAILED; + ret = RFAILED; + break; } #endif } @@ -5058,7 +5203,8 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) if(!duCfgParam.duName) { DU_LOG("\nERROR --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__); - return RFAILED; + ret = RFAILED; + break; } strcpy((char*)duCfgParam.duName, tempDuName); } @@ -5101,7 +5247,8 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) { if(parseSctpParams(doc, ns, cur, &duCfgParam.sctpParams) != ROK) { - return RFAILED; + ret = RFAILED; + break; } duCfgParam.sctpParams.duIpAddr.ipV4Pres = true; duCfgParam.sctpParams.duIpAddr.ipV4Addr = duIp; @@ -5115,7 +5262,8 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) { if(parseEgtpParams(doc, ns, cur, &duCfgParam.egtpParams) != ROK) { - return RFAILED; + ret = RFAILED; + break; } duCfgParam.egtpParams.localIp.ipV4Addr = duIp; duCfgParam.egtpParams.localIp.ipV4Pres = true; @@ -5128,7 +5276,8 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) { if(parseMibParams(doc, ns, cur, &duCfgParam.mibParams) != ROK) { - return RFAILED; + ret = RFAILED; + break; } } @@ -5136,7 +5285,8 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) { if(parseSib1Params(doc, ns, cur, &duCfgParam.sib1Params) != ROK) { - return RFAILED; + ret = RFAILED; + break; } } @@ -5144,7 +5294,8 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) { if(parseF1DuServedCellInfo(doc, ns, cur, &duCfgParam.srvdCellLst[0]) != ROK) { - return RFAILED; + ret = RFAILED; + break; } } @@ -5152,7 +5303,8 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) { if(parseMacCellCfg(doc, ns, cur, &duCfgParam.macCellCfg) != ROK) { - return RFAILED; + ret = RFAILED; + break; } } @@ -5161,7 +5313,8 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) { if(parseMacSliceCfgReq(doc, ns, cur, &duCfgParam.tempSliceCfg) != ROK) { - return RFAILED; + ret = RFAILED; + break; } } #endif @@ -5170,7 +5323,8 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) { if(parseDuTimerParams(doc, ns, cur, &duCb.duTimersInfo) != ROK) { - return RFAILED; + ret = RFAILED; + break; } } @@ -5178,7 +5332,8 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) { if(parseE2ConfigParams(doc, ns, cur, &duCb.e2apDb) != ROK) { - return RFAILED; + ret = RFAILED; + break; } else { @@ -5192,13 +5347,19 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) { if(parseGlobalConfigParams(doc, ns, cur) != ROK) { - return RFAILED; + ret = RFAILED; + break; } } cur = cur -> next; } - return ROK; + + if(ret != ROK) + { + freeDuCfgParams(); + } + return ret; } /******************************************************************* diff --git a/src/du_app/du_e2ap_msg_hdl.c b/src/du_app/du_e2ap_msg_hdl.c index 2a5df4ae1..0915041c5 100644 --- a/src/du_app/du_e2ap_msg_hdl.c +++ b/src/du_app/du_e2ap_msg_hdl.c @@ -1417,8 +1417,10 @@ void freeE2smKpmRanFunctionDefinition(E2SM_KPM_RANfunction_Description_t *ranFun DU_FREE(measInfoList->measName.buf, measInfoList->measName.size); DU_FREE(measInfoList,sizeof(MeasurementInfo_Action_Item_t)); } + DU_FREE(measInfoList, sizeof(MeasurementInfo_Action_Item_t)); } - DU_FREE(measInfoList,ricReportStyle->list.array[reportStyleIdx]->measInfo_Action_List.list.size); + DU_FREE(ricReportStyle->list.array[reportStyleIdx]->measInfo_Action_List.list.array\ + ,ricReportStyle->list.array[reportStyleIdx]->measInfo_Action_List.list.size); } DU_FREE(ricReportStyle->list.array[reportStyleIdx], sizeof(RIC_ReportStyle_Item_t)); }