pespin submitted this change.
bts: Properly free ctr/stat when bts object is freed
This was so far workarounded in tests by manually freeing the fields.
However, in follow-up patch the paging queue will also be properly
freed, so free of the counters needs to be previously fixed too so that
counters are freed at the right point of time.
Otherwise, during paging queue flush, counters are used and would crash
because they were freed before the BTS object in each test's bts_del().
Change-Id: Id213e21cf9bfc5439021e459c22ba4704d8cae2b
---
M src/osmo-bsc/bts.c
M tests/acc/acc_test.c
M tests/gsm0408/gsm0408_test.c
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index 02cd3a8..2dfd4fa 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -163,6 +163,9 @@
osmo_fsm_inst_free(bts->mo.fi);
bts->mo.fi = NULL;
}
+
+ osmo_stat_item_group_free(bts->bts_statg);
+ rate_ctr_group_free(bts->bts_ctrs);
return 0;
}
diff --git a/tests/acc/acc_test.c b/tests/acc/acc_test.c
index 1e78f73..ce3b0cb 100644
--- a/tests/acc/acc_test.c
+++ b/tests/acc/acc_test.c
@@ -58,8 +58,6 @@
#define bts_del(bts) _bts_del(bts, __func__)
static inline void _bts_del(struct gsm_bts *bts, const char *msg)
{
- osmo_stat_item_group_free(bts->bts_statg);
- rate_ctr_group_free(bts->bts_ctrs);
if (osmo_timer_pending(&bts->acc_mgr.rotate_timer))
osmo_timer_del(&bts->acc_mgr.rotate_timer);
if (osmo_timer_pending(&bts->acc_ramp.step_timer))
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index a7270a4..03b2ee1 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -137,8 +137,6 @@
#define bts_del(bts) _bts_del(bts, __func__)
static inline void _bts_del(struct gsm_bts *bts, const char *msg)
{
- osmo_stat_item_group_free(bts->bts_statg);
- rate_ctr_group_free(bts->bts_ctrs);
if (osmo_timer_pending(&bts->acc_mgr.rotate_timer))
osmo_timer_del(&bts->acc_mgr.rotate_timer);
/* no need to llist_del(&bts->list), we never registered the bts there. */
To view, visit change 28003. To unsubscribe, or for help writing mail filters, visit settings.