aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-07-16 18:23:33 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-07-16 19:24:16 +0200
commit0f352a6f2293534fa31bfe81cf85ea7dbe317481 (patch)
treeb24d23bf6ba9123531b74d7f7b74c155776bb2d2
parentbf9042203d02298040e5289c86238961c154a3d4 (diff)
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
-rw-r--r--tests/alloc/AllocTest.cpp4
1 files changed, 4 insertions, 0 deletions
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;
}