From 0f352a6f2293534fa31bfe81cf85ea7dbe317481 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Thu, 16 Jul 2015 18:23:33 +0200 Subject: alloc/test: Free the TBF if the recursion has failed Currently if both an uplink and a downlink TBF are to be allocated by alloc_tbfs() and the second allocation fails, the first TBF is not freed. This commit changes the recursive function to free the TBF if the ms variable has been changed to NULL. Sponsored-by: On-Waves ehf --- tests/alloc/AllocTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index f6170058..ac67ce95 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -539,12 +539,16 @@ static GprsMs *alloc_tbfs(BTS *the_bts, GprsMs *ms, unsigned ms_class, case TEST_MODE_DL_AFTER_UL: case TEST_MODE_UL_AFTER_DL: tbf_free(tbf); + tbf = NULL; break; default: break; } + if (!ms && tbf) + tbf_free(tbf); + return guard2.is_idle() ? NULL : ms; } -- cgit v1.2.3