diff options
-rw-r--r-- | src/bts.cpp | 22 | ||||
-rw-r--r-- | src/bts.h | 2 | ||||
-rw-r--r-- | src/pcu_main.cpp | 1 |
3 files changed, 22 insertions, 3 deletions
diff --git a/src/bts.cpp b/src/bts.cpp index 1804c528..e07b840f 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -197,6 +197,11 @@ struct gprs_rlcmac_bts *bts_main_data() return BTS::main_bts()->bts_data(); } +void bts_cleanup() +{ + return BTS::main_bts()->cleanup(); +} + struct rate_ctr_group *bts_main_data_stats() { return BTS::main_bts()->rate_counters(); @@ -239,16 +244,27 @@ BTS::BTS() OSMO_ASSERT(m_statg); } -BTS::~BTS() +void BTS::cleanup() { /* this can cause counter updates and must not be left to the * m_ms_store's destructor */ m_ms_store.cleanup(); - rate_ctr_group_free(m_ratectrs); - osmo_stat_item_group_free(m_statg); + if (m_ratectrs) { + rate_ctr_group_free(m_ratectrs); + m_ratectrs = NULL; + } + + if (m_statg) { + osmo_stat_item_group_free(m_statg); + m_statg = NULL; + } } +BTS::~BTS() +{ + cleanup(); +} void BTS::set_current_frame_number(int fn) { @@ -272,6 +272,7 @@ public: BTS(); ~BTS(); + void cleanup(); static BTS* main_bts(); @@ -591,6 +592,7 @@ CREATE_STAT_INLINE(ms_present, ms_present_get, STAT_MS_PRESENT); #ifdef __cplusplus extern "C" { #endif + void bts_cleanup(); struct gprs_rlcmac_bts *bts_main_data(); struct rate_ctr_group *bts_main_data_stats(); struct osmo_stat_item_group *bts_main_data_stat_items(); diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp index a0f31d16..c39c3376 100644 --- a/src/pcu_main.cpp +++ b/src/pcu_main.cpp @@ -356,6 +356,7 @@ int main(int argc, char *argv[]) pcu_l1if_close(); + bts_cleanup(); talloc_report_full(tall_pcu_ctx, stderr); talloc_free(tall_pcu_ctx); |