Commit 161ef339 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Free ASN1 decoder memory for BCCH

parent 1576f353
...@@ -552,42 +552,39 @@ int8_t nr_ue_process_spcell_config(NR_SpCellConfig_t *spcell_config){ ...@@ -552,42 +552,39 @@ int8_t nr_ue_process_spcell_config(NR_SpCellConfig_t *spcell_config){
/*brief decode BCCH-BCH (MIB) message*/ /*brief decode BCCH-BCH (MIB) message*/
int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message( int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
const module_id_t module_id, const module_id_t module_id,
const uint8_t gNB_index, const uint8_t gNB_index,
uint8_t *const bufferP, uint8_t *const bufferP,
const uint8_t buffer_len ){ const uint8_t buffer_len ){
NR_BCCH_BCH_Message_t *bcch_message = NULL; NR_BCCH_BCH_Message_t *bcch_message = NULL;
if (NR_UE_rrc_inst[module_id].mib != NULL) if (NR_UE_rrc_inst[module_id].mib == NULL)
SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 ); LOG_A(NR_RRC, "Configuring MAC for first MIB reception\n");
else
LOG_A(NR_RRC, "Configuring MAC for first MIB reception\n"); asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_BCCH_BCH_Message,
asn_dec_rval_t dec_rval = uper_decode_complete(NULL, (void **)&bcch_message,
&asn_DEF_NR_BCCH_BCH_Message, (const void *)bufferP,
(void **)&bcch_message, buffer_len );
(const void *)bufferP,
buffer_len ); int ret;
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) {
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) { LOG_E(NR_RRC,"NR_BCCH_BCH decode error\n");
LOG_E(NR_RRC,"NR_BCCH_BCH decode error\n"); ret = -1;
// free the memory }
SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 ); else {
return -1; // link to rrc instance
} ASN_STRUCT_FREE(asn_DEF_NR_MIB, NR_UE_rrc_inst[module_id].mib);
else { NR_UE_rrc_inst[module_id].mib = bcch_message->message.choice.mib;
// link to rrc instance bcch_message->message.choice.mib = NULL;
SEQUENCE_free( &asn_DEF_NR_MIB, (void *)NR_UE_rrc_inst[module_id].mib, 1 );
NR_UE_rrc_inst[module_id].mib = bcch_message->message.choice.mib;
//memcpy( (void *)mib,
// (void *)&bcch_message->message.choice.mib,
// sizeof(NR_MIB_t) );
nr_rrc_mac_config_req_ue( 0, 0, 0, NR_UE_rrc_inst[module_id].mib, NULL, NULL, NULL);
}
return 0; nr_rrc_mac_config_req_ue( 0, 0, 0, NR_UE_rrc_inst[module_id].mib, NULL, NULL, NULL);
ret = 0;
}
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, bcch_message);
return ret;
} }
const char *nr_SIBreserved( long value ) { const char *nr_SIBreserved( long value ) {
...@@ -2245,6 +2242,7 @@ nr_rrc_ue_establish_srb2( ...@@ -2245,6 +2242,7 @@ nr_rrc_ue_establish_srb2(
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(NR_RRC, "Failed to decode DL-DCCH (%zu bytes)\n", dec_rval.consumed); LOG_E(NR_RRC, "Failed to decode DL-DCCH (%zu bytes)\n", dec_rval.consumed);
ASN_STRUCT_FREE(asn_DEF_NR_DL_DCCH_Message, dl_dcch_msg);
return -1; return -1;
} }
......
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