aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-03-05 05:31:14 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-03-28 19:24:34 +0200
commite34161832d936959640d5e5735dfa1ca7bccae13 (patch)
treeec2853807f0e1ae88607eea6e68e3edd0e51ad70 /tests/bsc
parent68c76e9036538d51232c61ce8c5c28e4035456ac (diff)
ctx cleanup: use non-NULL talloc ctx for osmo_init_logging2()
Fix various sanitizer complaints about memory leaks using a sanitizer build with gcc (Debian 7.3.0-12) 7.3.0. Also fix deprecation warnings on osmo_init_logging(). Depends: I216837780e9405fdaec8059c63d10699c695b360 (libosmocore) Change-Id: I970c6f8a0e36a8b63e42349dbc92baff649e5cef
Diffstat (limited to 'tests/bsc')
-rw-r--r--tests/bsc/bsc_test.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/bsc/bsc_test.c b/tests/bsc/bsc_test.c
index 744b9e1cb..106b08bc7 100644
--- a/tests/bsc/bsc_test.c
+++ b/tests/bsc/bsc_test.c
@@ -39,6 +39,8 @@
#include <stdio.h>
#include <search.h>
+void *ctx = NULL;
+
enum test {
TEST_SCAN_TO_BTS,
TEST_SCAN_TO_MSC,
@@ -122,7 +124,7 @@ static void test_scan(void)
{
int i;
- struct gsm_network *net = bsc_network_init(NULL);
+ struct gsm_network *net = bsc_network_init(ctx);
struct gsm_bts *bts = gsm_bts_alloc(net, 0);
struct bsc_msc_data *msc;
struct gsm_subscriber_connection *conn;
@@ -227,12 +229,14 @@ static const struct log_info log_info = {
int main(int argc, char **argv)
{
- msgb_talloc_ctx_init(NULL, 0);
- osmo_init_logging(&log_info);
+ ctx = talloc_named_const(NULL, 0, "bsc-test");
+ msgb_talloc_ctx_init(ctx, 0);
+ osmo_init_logging2(ctx, &log_info);
test_scan();
printf("Testing execution completed.\n");
+ talloc_free(ctx);
return 0;
}