bts: Call gprs_bssgp_destroy() in destructor
Change-Id: I7ed7f489f36f88277e2d5e393edcb339bf0cbba0
diff --git a/src/bts.cpp b/src/bts.cpp
index 5c870af..e955687 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -245,6 +245,8 @@
bts->ms_store->cleanup();
delete bts->ms_store;
+ gprs_bssgp_destroy(bts);
+
osmo_time_cc_cleanup(&bts->all_allocated_pdch);
if (bts->ratectrs) {
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 4651269..585496a 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -528,7 +528,6 @@
OSMO_ASSERT(rc == -EBUSY);
fprintf(stderr, "=== end %s ===\n", __func__);
- gprs_bssgp_destroy(bts);
TALLOC_FREE(the_pcu);
}
@@ -623,7 +622,6 @@
fprintf(stderr, "=== end %s ===\n", __func__);
- gprs_bssgp_destroy(bts);
TALLOC_FREE(the_pcu);
}
@@ -2271,14 +2269,12 @@
OSMO_ASSERT(rc == 0);
fprintf(stderr, "=== end %s ===\n", __func__);
- gprs_bssgp_destroy(bts);
TALLOC_FREE(the_pcu);
}
static inline void ws_check(gprs_rlcmac_dl_tbf *dl_tbf, const char *test, uint8_t exp_slots, uint16_t exp_ws,
- bool free, bool end)
+ bool free)
{
- gprs_rlcmac_bts *bts = dl_tbf->bts;
if (!dl_tbf) {
fprintf(stderr, "%s(): FAILED (NULL TBF)\n", test);
return;
@@ -2297,11 +2293,6 @@
if (free)
tbf_free(dl_tbf);
-
- if (end) {
- fprintf(stderr, "=== end %s ===\n", test);
- gprs_bssgp_destroy(bts);
- }
}
static void test_tbf_ws()
@@ -2337,7 +2328,7 @@
ms = bts_alloc_ms(bts, ms_class, 0);
dl_tbf = tbf_alloc_dl_tbf(bts, ms, 0, false);
- ws_check(dl_tbf, __func__, 4, 64, true, false);
+ ws_check(dl_tbf, __func__, 4, 64, true);
/* EGPRS-only */
@@ -2345,7 +2336,8 @@
ms = bts_alloc_ms(bts, ms_class, ms_class);
dl_tbf = tbf_alloc_dl_tbf(bts, ms, 0, false);
- ws_check(dl_tbf, __func__, 4, 128 + 4 * 64, true, true);
+ ws_check(dl_tbf, __func__, 4, 128 + 4 * 64, true);
+ fprintf(stderr, "=== end %s ===\n", __func__);
TALLOC_FREE(the_pcu);
}
@@ -2384,12 +2376,13 @@
ms = bts_alloc_ms(bts, ms_class, ms_class);
dl_tbf = tbf_alloc_dl_tbf(bts, ms, 0, true);
- ws_check(dl_tbf, __func__, 1, 128 + 1 * 64, false, false);
+ ws_check(dl_tbf, __func__, 1, 128 + 1 * 64, false);
dl_tbf->update();
/* window size should be 384 */
- ws_check(dl_tbf, __func__, 4, 128 + 4 * 64, true, true);
+ ws_check(dl_tbf, __func__, 4, 128 + 4 * 64, true);
+ fprintf(stderr, "=== end %s ===\n", __func__);
TALLOC_FREE(the_pcu);
}