fix mem leak in phch_recv

master
Andre Puschmann 7 years ago
parent 44b1748a87
commit cbda94f0a6

@ -199,6 +199,7 @@ private:
uint32_t offset; uint32_t offset;
} cell_info_t; } cell_info_t;
void init(srslte::log *log_h, bool sic_pss_enabled, uint32_t max_sf_window); void init(srslte::log *log_h, bool sic_pss_enabled, uint32_t max_sf_window);
void deinit();
void reset(); void reset();
int find_cells(cf_t *input_buffer, float rx_gain_offset, srslte_cell_t current_cell, uint32_t nof_sf, cell_info_t found_cells[MAX_CELLS]); int find_cells(cf_t *input_buffer, float rx_gain_offset, srslte_cell_t current_cell, uint32_t nof_sf, cell_info_t found_cells[MAX_CELLS]);
private: private:
@ -220,6 +221,7 @@ private:
// Class to perform intra-frequency measurements // Class to perform intra-frequency measurements
class intra_measure : public thread { class intra_measure : public thread {
public: public:
~intra_measure();
void init(phch_common *common, rrc_interface_phy *rrc, srslte::log *log_h); void init(phch_common *common, rrc_interface_phy *rrc, srslte::log *log_h);
void stop(); void stop();
void add_cell(int pci); void add_cell(int pci);

@ -711,6 +711,12 @@ void phch_recv::run_thread()
mac->tti_clock(tti); mac->tti_clock(tti);
tti = (tti+1) % 10240; tti = (tti+1) % 10240;
} }
for (int i=0;i<SRSLTE_MAX_PORTS;i++) {
if (dummy_buffer[i]) {
free(dummy_buffer[i]);
}
}
} }
void phch_recv::in_sync() { void phch_recv::in_sync() {
@ -1238,6 +1244,13 @@ void phch_recv::scell_recv::reset()
measure_p.reset(); measure_p.reset();
} }
void phch_recv::scell_recv::deinit()
{
srslte_sync_free(&sync_find);
free(input_cfo_corrected);
free(sf_buffer[0]);
}
int phch_recv::scell_recv::find_cells(cf_t *input_buffer, float rx_gain_offset, srslte_cell_t cell, uint32_t nof_sf, cell_info_t cells[MAX_CELLS]) int phch_recv::scell_recv::find_cells(cf_t *input_buffer, float rx_gain_offset, srslte_cell_t cell, uint32_t nof_sf, cell_info_t cells[MAX_CELLS])
{ {
uint32_t fft_sz = srslte_symbol_sz(cell.nof_prb); uint32_t fft_sz = srslte_symbol_sz(cell.nof_prb);
@ -1433,6 +1446,12 @@ void phch_recv::intra_measure::stop() {
wait_thread_finish(); wait_thread_finish();
} }
phch_recv::intra_measure::~intra_measure() {
srslte_ringbuffer_free(&ring_buffer);
scell.deinit();
free(search_buffer);
}
void phch_recv::intra_measure::set_primay_cell(uint32_t earfcn, srslte_cell_t cell) { void phch_recv::intra_measure::set_primay_cell(uint32_t earfcn, srslte_cell_t cell) {
this->current_earfcn = earfcn; this->current_earfcn = earfcn;
current_sflen = SRSLTE_SF_LEN_PRB(cell.nof_prb); current_sflen = SRSLTE_SF_LEN_PRB(cell.nof_prb);

Loading…
Cancel
Save