Commit d298b4fe authored by Robert Schmidt's avatar Robert Schmidt

Fix memory leaks in nr_ulschsim

parent 1f2dfd5d
...@@ -454,46 +454,39 @@ int main(int argc, char **argv) ...@@ -454,46 +454,39 @@ int main(int argc, char **argv)
rel15_ul->pusch_data.tb_size = TBS/8; rel15_ul->pusch_data.tb_size = TBS/8;
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc double modulated_input[16 * 68 * 384]; // [hna] 16 segments, 68*Zc
short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384); short channel_output_fixed[16 * 68 * 384];
short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384); short channel_output_uncoded[16 * 68 * 384];
unsigned int errors_bit_uncoded = 0; unsigned int errors_bit_uncoded = 0;
unsigned char *estimated_output_bit;
unsigned char *test_input_bit;
unsigned int errors_bit = 0; unsigned int errors_bit = 0;
test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384); unsigned char test_input_bit[16 * 68 * 384];
estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384); unsigned char estimated_output_bit[16 * 68 * 384];
unsigned char *test_input;
test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8);
for (i = 0; i < TBS / 8; i++)
test_input[i] = (unsigned char) rand();
/////////////////////////[adk] preparing UL harq_process parameters///////////////////////// /////////////////////////[adk] preparing UL harq_process parameters/////////////////////////
/////////// ///////////
NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
DevAssert(harq_process_ul_ue);
N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
N_RE_prime = NR_NB_SC_PER_RB*nb_symb_sch - nb_re_dmrs - N_PRB_oh; N_RE_prime = NR_NB_SC_PER_RB*nb_symb_sch - nb_re_dmrs - N_PRB_oh;
if (harq_process_ul_ue) { harq_process_ul_ue->pusch_pdu.rnti = n_rnti;
harq_process_ul_ue->pusch_pdu.mcs_index = Imcs;
harq_process_ul_ue->pusch_pdu.rnti = n_rnti; harq_process_ul_ue->pusch_pdu.nrOfLayers = Nl;
harq_process_ul_ue->pusch_pdu.mcs_index = Imcs; harq_process_ul_ue->pusch_pdu.rb_size = nb_rb;
harq_process_ul_ue->pusch_pdu.nrOfLayers = Nl; harq_process_ul_ue->pusch_pdu.nr_of_symbols = nb_symb_sch;
harq_process_ul_ue->pusch_pdu.rb_size = nb_rb; harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*nb_codewords;
harq_process_ul_ue->pusch_pdu.nr_of_symbols = nb_symb_sch; harq_process_ul_ue->pusch_pdu.pusch_data.rv_index = rvidx;
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*nb_codewords; harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = TBS/8;
harq_process_ul_ue->pusch_pdu.pusch_data.rv_index = rvidx; unsigned char *test_input = harq_process_ul_ue->a;
harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = TBS/8;
harq_process_ul_ue->a = &test_input[0];
}
/////////// ///////////
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
for (i = 0; i < TBS / 8; i++)
test_input[i] = (unsigned char) rand();
#ifdef DEBUG_NR_ULSCHSIM #ifdef DEBUG_NR_ULSCHSIM
for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%hhu \n",test_input[i]); for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%hhu \n",test_input[i]);
#endif #endif
...@@ -620,6 +613,11 @@ int main(int argc, char **argv) ...@@ -620,6 +613,11 @@ int main(int argc, char **argv)
printf("\n"); printf("\n");
} }
for (sf = 0; sf < 2; sf++)
for (i = 0; i < 2; i++)
free_nr_ue_ulsch(&UE->ulsch[sf][0][i], N_RB_UL);
free_channel_desc_scm(gNB2UE);
if (output_fd) if (output_fd)
fclose(output_fd); fclose(output_fd);
......
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