From 2f47010eb6377bd3a23c198fdcee1a0b38317745 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Tue, 24 Sep 2019 10:21:22 +0200 Subject: [PATCH] fix various uninitialized vars --- lib/src/phy/sync/test/nsss_test.c | 8 +++---- lib/src/phy/sync/test/sync_nbiot_test.c | 10 ++++---- lib/test/common/queue_test.cc | 2 +- srsue/hdr/phy/scell/intra_measure.h | 32 ++++++++++++------------- srsue/src/phy/scell/intra_measure.cc | 18 -------------- 5 files changed, 26 insertions(+), 44 deletions(-) diff --git a/lib/src/phy/sync/test/nsss_test.c b/lib/src/phy/sync/test/nsss_test.c index 514ca07fc..b2646fbfd 100644 --- a/lib/src/phy/sync/test/nsss_test.c +++ b/lib/src/phy/sync/test/nsss_test.c @@ -88,10 +88,10 @@ int main(int argc, char** argv) { cf_t* fft_buffer = NULL; cf_t* buffer = NULL; - srslte_nsss_synch_t syncobj; - srslte_ofdm_t ifft; - int fft_size; - float peak_value; + srslte_nsss_synch_t syncobj = {}; + srslte_ofdm_t ifft = {}; + int fft_size = 0; + float peak_value = 0.0; int num_sf = 1; int ret = SRSLTE_ERROR; diff --git a/lib/src/phy/sync/test/sync_nbiot_test.c b/lib/src/phy/sync/test/sync_nbiot_test.c index bf0a009fc..2f3e6a201 100644 --- a/lib/src/phy/sync/test/sync_nbiot_test.c +++ b/lib/src/phy/sync/test/sync_nbiot_test.c @@ -88,12 +88,12 @@ int main(int argc, char** argv) cf_t* fft_buffer = NULL; _Complex float buffer[SFLEN]; // FLEN + fft_size - srslte_filesource_t fsrc; + srslte_filesource_t fsrc = {}; uint32_t find_idx = 0; - srslte_sync_nbiot_t syncobj; - srslte_ofdm_t ifft; - srslte_cfo_t cfocorr; - int fft_size; + srslte_sync_nbiot_t syncobj = {}; + srslte_ofdm_t ifft = {}; + srslte_cfo_t cfocorr = {}; + int fft_size = 0; input_file_name = NULL; diff --git a/lib/test/common/queue_test.cc b/lib/test/common/queue_test.cc index 0c9899eea..72b66630a 100644 --- a/lib/test/common/queue_test.cc +++ b/lib/test/common/queue_test.cc @@ -206,7 +206,7 @@ int test_multiqueue_threading3() // Should be able to unlock all multiqueue.reset(); t1.join(); - TESTASSERT(t1_success) + TESTASSERT(t1_success); std::cout << "outcome: Success\n"; std::cout << "===================================================\n"; diff --git a/srsue/hdr/phy/scell/intra_measure.h b/srsue/hdr/phy/scell/intra_measure.h index 5033a7273..4282e04c7 100644 --- a/srsue/hdr/phy/scell/intra_measure.h +++ b/srsue/hdr/phy/scell/intra_measure.h @@ -50,29 +50,29 @@ private: void run_thread(); const static int INTRA_FREQ_MEAS_PRIO = DEFAULT_PRIORITY + 5; - scell_recv scell; - rrc_interface_phy_lte* rrc; - srslte::log* log_h; - phy_common* common; - uint32_t current_earfcn; - uint32_t current_sflen; - srslte_cell_t primary_cell; + scell_recv scell = {}; + rrc_interface_phy_lte* rrc = nullptr; + srslte::log* log_h = nullptr; + phy_common* common = nullptr; + uint32_t current_earfcn = 0; + uint32_t current_sflen = 0; + srslte_cell_t primary_cell = {}; std::vector active_pci; srslte::tti_sync_cv tti_sync; - cf_t* search_buffer; + cf_t* search_buffer = nullptr; - scell_recv::cell_info_t info[scell_recv::MAX_CELLS]; + scell_recv::cell_info_t info[scell_recv::MAX_CELLS] = {}; - bool running; - bool receive_enabled; - bool receiving; - uint32_t measure_tti; - uint32_t receive_cnt; - srslte_ringbuffer_t ring_buffer; + bool running = false; + bool receive_enabled = false; + bool receiving = false; + uint32_t measure_tti = 0; + uint32_t receive_cnt = 0; + srslte_ringbuffer_t ring_buffer = {}; - srslte_refsignal_dl_sync_t refsignal_dl_sync; + srslte_refsignal_dl_sync_t refsignal_dl_sync = {}; }; } // namespace scell diff --git a/srsue/src/phy/scell/intra_measure.cc b/srsue/src/phy/scell/intra_measure.cc index 26031b105..d650feea5 100644 --- a/srsue/src/phy/scell/intra_measure.cc +++ b/srsue/src/phy/scell/intra_measure.cc @@ -38,24 +38,6 @@ namespace scell { intra_measure::intra_measure() : scell(), thread("SYNC_INTRA_MEASURE") { - - rrc = nullptr; - common = nullptr; - search_buffer = nullptr; - log_h = nullptr; - - current_earfcn = 0; - current_sflen = 0; - measure_tti = 0; - receive_cnt = 0; - - running = false; - receive_enabled = false; - receiving = false; - - ZERO_OBJECT(info); - ZERO_OBJECT(ring_buffer); - ZERO_OBJECT(primary_cell); } intra_measure::~intra_measure()