Commit d7515686 authored by Laurent THOMAS's avatar Laurent THOMAS

fix a bug in call to realloc inside a function

parent d108d9c6
......@@ -41,6 +41,7 @@
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
#include <openair1/PHY/MODULATION/nr_modulation.h>
#if 0
void phy_config_harq_ue(module_id_t Mod_id,
......
......@@ -46,7 +46,7 @@ void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint32_t i;
uint8_t reset;
uint32_t x1, x2, s=0;
uint32_t x1=0, x2=0, s=0;
reset = 1;
// x1 is set in lte_gold_generic
......
......@@ -1826,12 +1826,12 @@ int main(int argc, char **argv) {
if (t_rx > 2000 )
n_rx_dropped++;
appendVarArray(table_tx, &t_tx);
appendVarArray(table_tx_ifft, &t_tx_ifft);
appendVarArray(table_rx, &t_rx );
appendVarArray(table_rx_fft, &t_rx_fft );
appendVarArray(table_rx_demod, &t_rx_demod );
appendVarArray(table_rx_dec, &t_rx_dec );
appendVarArray(&table_tx, &t_tx);
appendVarArray(&table_tx_ifft, &t_tx_ifft);
appendVarArray(&table_rx, &t_rx );
appendVarArray(&table_rx_fft, &t_rx_fft );
appendVarArray(&table_rx_demod, &t_rx_demod );
appendVarArray(&table_rx_dec, &t_rx_dec );
} //trials
// round_trials[0]: number of code word : goodput the protocol
......
......@@ -1971,12 +1971,12 @@ int main(int argc, char **argv) {
if (t_rx > 2000 )
n_rx_dropped++;
appendVarArray(table_tx, &t_tx);
appendVarArray(table_tx_ifft, &t_tx_ifft);
appendVarArray(table_rx, &t_rx );
appendVarArray(table_rx_fft, &t_rx_fft );
appendVarArray(table_rx_demod, &t_rx_demod );
appendVarArray(table_rx_dec, &t_rx_dec );
appendVarArray(&table_tx, &t_tx);
appendVarArray(&table_tx_ifft, &t_tx_ifft);
appendVarArray(&table_rx, &t_rx );
appendVarArray(&table_rx_fft, &t_rx_fft );
appendVarArray(&table_rx_demod, &t_rx_demod );
appendVarArray(&table_rx_dec, &t_rx_dec );
} //trials
// round_trials[0]: number of code word : goodput the protocol
......
......@@ -743,7 +743,7 @@ int main(int argc, char **argv) {
UE2eNB->max_Doppler = maxDoppler;
// NN: N_RB_UL has to be defined in ulsim
for (int k=0; k<NUMBER_OF_UE_MAX; k++) eNB->ulsch[k] = new_eNB_ulsch(max_turbo_iterations,N_RB_DL,0);
for (int k=0; k<NUMBER_OF_ULSCH_MAX; k++) eNB->ulsch[k] = new_eNB_ulsch(max_turbo_iterations,N_RB_DL,0);
UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0);
printf("ULSCH %p\n",UE->ulsch[0]);
......@@ -1279,14 +1279,14 @@ int main(int argc, char **argv) {
n_rx_dropped++;
if (trials < 1000) {
appendVarArray(table_tx, &t_tx);
appendVarArray(table_tx_ifft, &t_tx_ifft);
appendVarArray(table_tx_mod, &t_tx_mod );
appendVarArray(table_tx_enc, &t_tx_enc );
appendVarArray(table_rx, &t_rx );
appendVarArray(table_rx_fft, &t_rx_fft );
appendVarArray(table_rx_demod, &t_rx_demod );
appendVarArray(table_rx_dec, &t_rx_dec );
appendVarArray(&table_tx, &t_tx);
appendVarArray(&table_tx_ifft, &t_tx_ifft);
appendVarArray(&table_tx_mod, &t_tx_mod );
appendVarArray(&table_tx_enc, &t_tx_enc );
appendVarArray(&table_rx, &t_rx );
appendVarArray(&table_rx_fft, &t_rx_fft );
appendVarArray(&table_rx_demod, &t_rx_demod );
appendVarArray(&table_rx_dec, &t_rx_dec );
}
} //trials
......
......@@ -48,6 +48,8 @@
#include "UTIL/MEM/mem_block.h"
#include <common/utils/assertions.h>
//-----------------------------------------------------------------------------
void list_init (list_t* , char *);
......@@ -126,10 +128,13 @@ static inline void * dataArray(varArray_t * input) {
return input+1;
}
static inline void appendVarArray(varArray_t * input, void* data) {
static inline void appendVarArray(varArray_t ** inputPtr, void* data) {
varArray_t *input=*inputPtr;
if (input->size>=input->mallocedSize) {
input->mallocedSize+=input->increment;
input=(varArray_t *)realloc(input,sizeof(varArray_t)+input->mallocedSize*input->atomSize);
*inputPtr=(varArray_t *)realloc(input,sizeof(varArray_t)+input->mallocedSize*input->atomSize);
AssertFatal(*inputPtr, "no memory left");
input=*inputPtr;
}
memcpy((uint8_t*)(input+1)+input->atomSize*input->size++, data, input->atomSize);
}
......
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