aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-03-05 05:31:14 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-03-05 15:15:30 +0100
commitb10c480d9926378f20521c97f120a6895c09a53b (patch)
tree1fae54e82e2d8c7e5370492eafb35b398db98449
parentf7a6329bbd5dd621eccc10a05141b58f3b72ec06 (diff)
ctx cleanups WIPneels/deb9-asan
-rw-r--r--src/ipaccess/ipaccess-config.c2
-rw-r--r--src/ipaccess/ipaccess-proxy.c2
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c2
-rw-r--r--src/utils/bs11_config.c2
-rw-r--r--tests/abis/abis_test.c2
-rw-r--r--tests/bsc/bsc_test.c8
-rw-r--r--tests/channel/channel_test.c2
-rw-r--r--tests/gsm0408/gsm0408_test.c4
-rw-r--r--tests/handover/handover_test.c12
-rw-r--r--tests/nanobts_omlattr/nanobts_omlattr_test.c1
10 files changed, 25 insertions, 12 deletions
diff --git a/src/ipaccess/ipaccess-config.c b/src/ipaccess/ipaccess-config.c
index a1985b761..a0416bfc5 100644
--- a/src/ipaccess/ipaccess-config.c
+++ b/src/ipaccess/ipaccess-config.c
@@ -861,7 +861,7 @@ int main(int argc, char **argv)
tall_ctx_config = talloc_named_const(NULL, 0, "ipaccess-config");
msgb_talloc_ctx_init(tall_ctx_config, 0);
- osmo_init_logging(&log_info);
+ osmo_init_logging2(&log_info, tall_ctx_config);
log_parse_category_mask(osmo_stderr_target, "DNM,0");
bts_model_nanobts_init();
diff --git a/src/ipaccess/ipaccess-proxy.c b/src/ipaccess/ipaccess-proxy.c
index 6a3af287c..baa114d26 100644
--- a/src/ipaccess/ipaccess-proxy.c
+++ b/src/ipaccess/ipaccess-proxy.c
@@ -1228,7 +1228,7 @@ int main(int argc, char **argv)
tall_bsc_ctx = talloc_named_const(NULL, 1, "ipaccess-proxy");
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
- osmo_init_logging(&log_info);
+ osmo_init_logging2(&log_info, tall_bsc_ctx);
log_parse_category_mask(osmo_stderr_target, "DLINP:DLMI");
handle_options(argc, argv);
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index af8f83dae..ebf6a2ea3 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -415,7 +415,7 @@ int main(int argc, char **argv)
tall_tqe_ctx = talloc_named_const(tall_bsc_ctx, 0, "subch_txq_entry");
tall_ctr_ctx = talloc_named_const(tall_bsc_ctx, 0, "counter");
- osmo_init_logging(&log_info);
+ osmo_init_logging2(&log_info, tall_bsc_ctx);
osmo_stats_init(tall_bsc_ctx);
/* Allocate global gsm_network struct */
diff --git a/src/utils/bs11_config.c b/src/utils/bs11_config.c
index bc0f488d4..ea6b79007 100644
--- a/src/utils/bs11_config.c
+++ b/src/utils/bs11_config.c
@@ -911,7 +911,7 @@ int main(int argc, char **argv)
tall_fle_ctx = talloc_named_const(tall_bs11cfg_ctx, 0, "bs11_file_list_entry");
msgb_talloc_ctx_init(tall_bs11cfg_ctx, 0);
- osmo_init_logging(&log_info);
+ osmo_init_logging2(&log_info, tall_bs11cfg_ctx);
handle_options(argc, argv);
bts_model_bs11_init();
diff --git a/tests/abis/abis_test.c b/tests/abis/abis_test.c
index 6369b0701..0e296f58a 100644
--- a/tests/abis/abis_test.c
+++ b/tests/abis/abis_test.c
@@ -179,7 +179,7 @@ static const struct log_info log_info = {
int main(int argc, char **argv)
{
- osmo_init_logging(&log_info);
+ osmo_init_logging2(&log_info, NULL);
test_sw_selection();
test_abis_nm_ipaccess_cgi();
diff --git a/tests/bsc/bsc_test.c b/tests/bsc/bsc_test.c
index 541a44caf..298dc6069 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,11 +229,13 @@ static const struct log_info log_info = {
int main(int argc, char **argv)
{
- msgb_talloc_ctx_init(NULL, 0);
+ ctx = talloc_named_const(NULL, 0, "bsc-test");
+ msgb_talloc_ctx_init(ctx, 0);
osmo_init_logging(&log_info);
test_scan();
printf("Testing execution completed.\n");
+ talloc_free(ctx);
return 0;
}
diff --git a/tests/channel/channel_test.c b/tests/channel/channel_test.c
index b41e3d6a7..186f3bd37 100644
--- a/tests/channel/channel_test.c
+++ b/tests/channel/channel_test.c
@@ -98,7 +98,7 @@ static const struct log_info log_info = {
int main(int argc, char **argv)
{
- osmo_init_logging(&log_info);
+ osmo_init_logging2(&log_info, NULL);
test_dyn_ts_subslots();
test_bts_debug_print();
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index 9f5a5c41f..3957bfb32 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -831,7 +831,9 @@ int main(int argc, char **argv)
{
struct gsm_network *net;
- osmo_init_logging(&log_info);
+ tall_bsc_ctx = talloc_named_const(NULL, 0, "gsm0408_test");
+
+ osmo_init_logging2(&log_info, tall_bsc_ctx);
log_set_log_level(osmo_stderr_target, LOGL_INFO);
net = bsc_network_init(tall_bsc_ctx);
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 8ba97fd8e..ca2e409c0 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -40,6 +40,8 @@
#include <osmocom/bsc/bsc_api.h>
#include <osmocom/bsc/osmo_bsc.h>
+void *ctx;
+
struct gsm_network *bsc_gsmnet;
/* measurement report */
@@ -161,7 +163,7 @@ static struct gsm_bts *create_bts(int arfcn)
bts->codec.hr = 1;
bts->codec.amr = 1;
- rsl_link = talloc_zero(0, struct e1inp_sign_link);
+ rsl_link = talloc_zero(ctx, struct e1inp_sign_link);
rsl_link->trx = bts->c0;
bts->c0->rsl_link = rsl_link;
@@ -1274,6 +1276,9 @@ int main(int argc, char **argv)
int test_case_i;
int last_test_i;
+ ctx = talloc_named_const(NULL, 0, "handover_test");
+ msgb_talloc_ctx_init(ctx, 0);
+
test_case_i = argc > 1? atoi(argv[1]) : -1;
last_test_i = ARRAY_SIZE(test_cases) - 1;
@@ -1286,14 +1291,14 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- osmo_init_logging(&log_info);
+ osmo_init_logging2(&log_info, ctx);
log_set_print_category(osmo_stderr_target, 1);
log_set_print_category_hex(osmo_stderr_target, 0);
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_BASENAME);
/* Create a dummy network */
- bsc_gsmnet = bsc_network_init(NULL);
+ bsc_gsmnet = bsc_network_init(ctx);
if (!bsc_gsmnet)
exit(1);
@@ -1600,6 +1605,7 @@ int main(int argc, char **argv)
fprintf(stderr, "--------------------\n");
+ talloc_free(ctx);
return EXIT_SUCCESS;
}
diff --git a/tests/nanobts_omlattr/nanobts_omlattr_test.c b/tests/nanobts_omlattr/nanobts_omlattr_test.c
index 0554f4393..2cde892bd 100644
--- a/tests/nanobts_omlattr/nanobts_omlattr_test.c
+++ b/tests/nanobts_omlattr/nanobts_omlattr_test.c
@@ -284,6 +284,7 @@ int main(int argc, char **argv)
talloc_free(trx);
talloc_report_full(ctx, stderr);
OSMO_ASSERT(talloc_total_blocks(ctx) == 1);
+ talloc_free(ctx);
return 0;
}