From bf5e3cb3a4149f4a88a65be57c720f29c91c2c55 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 9 May 2022 16:31:22 +0200 Subject: [PATCH] bts: Call gprs_bssgp_destroy() in destructor Change-Id: I7ed7f489f36f88277e2d5e393edcb339bf0cbba0 --- src/bts.cpp | 2 ++ tests/tbf/TbfTest.cpp | 21 +++++++-------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/bts.cpp b/src/bts.cpp index 5c870afb..e9556870 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -245,6 +245,8 @@ static int bts_talloc_destructor(struct gprs_rlcmac_bts* bts) 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 46512694..585496af 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -528,7 +528,6 @@ static void test_tbf_exhaustion() OSMO_ASSERT(rc == -EBUSY); fprintf(stderr, "=== end %s ===\n", __func__); - gprs_bssgp_destroy(bts); TALLOC_FREE(the_pcu); } @@ -623,7 +622,6 @@ static void test_tbf_dl_llc_loss() fprintf(stderr, "=== end %s ===\n", __func__); - gprs_bssgp_destroy(bts); TALLOC_FREE(the_pcu); } @@ -2271,14 +2269,12 @@ static void test_tbf_gprs_egprs() 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 @@ static inline void ws_check(gprs_rlcmac_dl_tbf *dl_tbf, const char *test, uint8_ 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 @@ static void test_tbf_ws() 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 @@ static void test_tbf_ws() 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 @@ static void test_tbf_update_ws(void) 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); }