Commit 7317efea authored by Robert Schmidt's avatar Robert Schmidt

Clone pusch_Config to prevent double free

parent 10a0a526
......@@ -137,6 +137,20 @@ static NR_SetupRelease_PDSCH_ConfigCommon_t *clone_pdsch_configcommon(const NR_S
return clone;
}
static NR_PUSCH_Config_t *clone_pusch_config(const NR_PUSCH_Config_t *pc)
{
if (pc == NULL)
return NULL;
uint8_t buf[1024];
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_PUSCH_Config, NULL, pc, buf, sizeof(buf));
AssertFatal(enc_rval.encoded > 0 && enc_rval.encoded < sizeof(buf), "could not clone NR_PUSCH_Config: problem while encoding\n");
NR_PUSCH_Config_t *clone = NULL;
asn_dec_rval_t dec_rval = uper_decode(NULL, &asn_DEF_NR_PUSCH_Config, (void **)&clone, buf, enc_rval.encoded, 0, 0);
AssertFatal(dec_rval.code == RC_OK && dec_rval.consumed == enc_rval.encoded, "could not clone NR_PUSCH_Config: problem while decoding\n");
return clone;
}
NR_SearchSpace_t *rrc_searchspace_config(bool is_common, int searchspaceid, int coresetid)
{
......@@ -1402,7 +1416,8 @@ static void config_uplinkBWP(NR_BWP_Uplink_t *ubwp,
NR_PUSCH_Config_t *pusch_Config = NULL;
if(servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList &&
bwp_loop < servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count) {
pusch_Config = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Dedicated->pusch_Config->choice.setup;
pusch_Config = clone_pusch_config(servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]
->bwp_Dedicated->pusch_Config->choice.setup);
}
ubwp->bwp_Dedicated->pusch_Config = config_pusch(pusch_Config, scc, configuration->force_256qam_off ? NULL : uecap);
......@@ -2727,8 +2742,8 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC
NR_PUSCH_Config_t *pusch_Config = NULL;
if (servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList) {
pusch_Config =
servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup;
pusch_Config = clone_pusch_config(
servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup);
}
initialUplinkBWP->pusch_Config = config_pusch(pusch_Config, servingcellconfigcommon, uecap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment