diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-04-17 18:23:56 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-04-20 16:17:39 +0200 |
commit | fe7aee9302c6778494e024b77d9a870d8624a38d (patch) | |
tree | 448de5cbfd09355746802ea5c768c8657a6cedaf /tests/ms/MsTest.cpp | |
parent | eb0a0527e0a720fa9b0e351b5b38a8e46cb286e5 (diff) |
ms: store in bts->ms_list during alloc/destroy of ms object
With this change the MS no longer is removed from the llist without
potentially skipping free() if not idle in bts_ms_idle_cb().
As a result, some unit tests now can free it during bts tear down
instead of having them leaked.
The tests int MsTest need changes because the tbfs created are fake and
cannot be freed using tbf_free(), and hence cannot be detached from MS
using regular code paths. Instead first call explicit talloc_free(ms)
like other unit tests in the file already do.
Change-Id: Id53f8dfb9963366dd4b19a324615bbc83c4f23e7
Diffstat (limited to 'tests/ms/MsTest.cpp')
-rw-r--r-- | tests/ms/MsTest.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/ms/MsTest.cpp b/tests/ms/MsTest.cpp index 45051d4a..84cb52e8 100644 --- a/tests/ms/MsTest.cpp +++ b/tests/ms/MsTest.cpp @@ -457,6 +457,7 @@ static void test_ms_storage() ms = bts_get_ms_by_tlli(bts, tlli + 1, GSM_RESERVED_TMSI); OSMO_ASSERT(ms == NULL); + talloc_free(ms); talloc_free(ul_tbf); talloc_free(bts); printf("=== end %s ===\n", __func__); @@ -548,6 +549,7 @@ static void test_ms_cs_selection() OSMO_ASSERT(mcs_chan_code(ms_current_cs_dl(ms, ms_mode(ms))) == 2); + talloc_free(ms); talloc_free(dl_tbf); talloc_free(bts); printf("=== end %s ===\n", __func__); @@ -617,6 +619,8 @@ static void test_ms_mcs_mode() ms_set_mode(ms2, GPRS); dump_ms(ms2, "2: after mode set "); + talloc_free(ms1); + talloc_free(ms2); talloc_free(dl_tbf); talloc_free(bts); printf("=== end %s ===\n", __func__); |