UL ref sequences: prevent double-initialization
The existing code prevents double initialization if e.g., both gNB&UE
call these functions (like in a simulator). However, in the case of a
double-initialization such as stopping and re-starting the L1, the
memory will be freed, but not freed again. Basically, this works:
generate()
generate() # not initialized again
but this leads to problems:
generate()
free()
generate() # not initialized again, but should be!
Reimplement the check based on the data to be initialized, such that an
intermediate free() will be handled properly.
This commit is contained in:
@@ -177,10 +177,9 @@ c16_t *gNB_dmrs_lowpaprtype1_sequence[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MA
|
||||
void generate_lowpapr_typ1_refsig_sequences(unsigned int scaling)
|
||||
{
|
||||
/* prevent multiple calls, relevant when both UE & gNB initialize this */
|
||||
static bool already_called = false;
|
||||
bool already_called = gNB_dmrs_lowpaprtype1_sequence[0][0][0] != NULL;
|
||||
if (already_called)
|
||||
return;
|
||||
already_called = true;
|
||||
unsigned int v = 0; // sequence hopping and group hopping are not supported yet
|
||||
|
||||
for (unsigned int Msc_RS = 0; Msc_RS <= INDEX_SB_LESS_32; Msc_RS++) {
|
||||
@@ -200,9 +199,8 @@ c16_t *dmrs_lowpaprtype1_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_
|
||||
void generate_ul_reference_signal_sequences(unsigned int scaling)
|
||||
{
|
||||
/* prevent multiple calls, relevant when both UE & gNB initialize this */
|
||||
static bool already_called = false;
|
||||
bool already_called = rv_ul_ref_sig[0][0][0] != NULL;
|
||||
if (already_called) return;
|
||||
already_called = true;
|
||||
|
||||
unsigned int u,v,Msc_RS;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user