aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-04-16 00:57:10 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2018-04-16 01:03:48 +0200
commit5bd340eb5a176af428847949268869d71de8802c (patch)
tree7b65a93dc9a2e4309f04ca7921535b9b598c1930
parent69e356be93c420b5e2f8b96fbc89ef889cbcfe53 (diff)
use osmo_init_logging2(), fix regression test memleaks
Particularly gbproxy_test.c had various mem leaks, which (will) show up with gcc (Debian 7.3.0-15) 7.3.0 address sanitizer. Fix those leaks to verify that we don't have memleaks in the production code. Change-Id: Ia4204c8b3d895b42c103edecb61b99d3d22bd36f
-rw-r--r--src/gprs/gb_proxy_main.c2
-rw-r--r--src/gprs/gtphub_main.c2
-rw-r--r--src/gprs/sgsn_main.c2
-rw-r--r--src/libcommon/gsup_test_client.c5
-rw-r--r--tests/gbproxy/gbproxy_test.c82
-rw-r--r--tests/gprs/gprs_test.c3
-rw-r--r--tests/gtphub/gtphub_test.c5
-rw-r--r--tests/oap/oap_client_test.c5
-rw-r--r--tests/sgsn/sgsn_test.c2
-rw-r--r--tests/slhc/slhc_test.c7
-rw-r--r--tests/sndcp_xid/sndcp_xid_test.c7
-rw-r--r--tests/v42bis/v42bis_test.c7
-rw-r--r--tests/xid/xid_test.c7
13 files changed, 96 insertions, 40 deletions
diff --git a/src/gprs/gb_proxy_main.c b/src/gprs/gb_proxy_main.c
index 1416ff589..04143bba1 100644
--- a/src/gprs/gb_proxy_main.c
+++ b/src/gprs/gb_proxy_main.c
@@ -275,7 +275,7 @@ int main(int argc, char **argv)
signal(SIGUSR2, &signal_handler);
osmo_init_ignore_signals();
- osmo_init_logging(&gprs_log_info);
+ osmo_init_logging2(tall_bsc_ctx, &gprs_log_info);
vty_info.copyright = openbsc_copyright;
vty_init(&vty_info);
diff --git a/src/gprs/gtphub_main.c b/src/gprs/gtphub_main.c
index 197c5e3ba..a1a2c1de7 100644
--- a/src/gprs/gtphub_main.c
+++ b/src/gprs/gtphub_main.c
@@ -346,7 +346,7 @@ int main(int argc, char **argv)
signal(SIGUSR2, &signal_handler);
osmo_init_ignore_signals();
- osmo_init_logging(&gtphub_log_info);
+ osmo_init_logging2(osmo_gtphub_ctx, &gtphub_log_info);
vty_info.copyright = gtphub_copyright;
vty_init(&vty_info);
diff --git a/src/gprs/sgsn_main.c b/src/gprs/sgsn_main.c
index 0276e34a8..feffefb5f 100644
--- a/src/gprs/sgsn_main.c
+++ b/src/gprs/sgsn_main.c
@@ -386,7 +386,7 @@ int main(int argc, char **argv)
signal(SIGUSR2, &signal_handler);
osmo_init_ignore_signals();
- osmo_init_logging(&gprs_log_info);
+ osmo_init_logging2(tall_bsc_ctx, &gprs_log_info);
osmo_stats_init(tall_bsc_ctx);
vty_info.copyright = openbsc_copyright;
diff --git a/src/libcommon/gsup_test_client.c b/src/libcommon/gsup_test_client.c
index cc0f58b00..2357ba52a 100644
--- a/src/libcommon/gsup_test_client.c
+++ b/src/libcommon/gsup_test_client.c
@@ -272,10 +272,11 @@ int main(int argc, char **argv)
unsigned long long i;
char *server_host = "127.0.0.1";
uint16_t server_port = OSMO_GSUP_PORT;
+ void *ctx = talloc_named_const(NULL, 0, "gsup_test_client");
- osmo_init_logging(&gsup_test_client_log_info);
+ osmo_init_logging2(ctx, &gsup_test_client_log_info);
- g_gc = gsup_client_create("GSUPTEST", server_host, server_port,
+ g_gc = gsup_client_create(ctx, "GSUPTEST", server_host, server_port,
gsupc_read_cb, NULL);
diff --git a/tests/gbproxy/gbproxy_test.c b/tests/gbproxy/gbproxy_test.c
index 8edb17148..f9a1c6bf8 100644
--- a/tests/gbproxy/gbproxy_test.c
+++ b/tests/gbproxy/gbproxy_test.c
@@ -47,7 +47,7 @@
#define MATCH_ANY (-1)
-void *tall_bsc_ctx;
+void *tall_bsc_ctx = NULL;
struct gbproxy_config gbcfg = {0};
@@ -1329,7 +1329,7 @@ static void gprs_dump_nsi(struct gprs_ns_inst *nsi)
static void test_gbproxy()
{
- struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
+ struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, tall_bsc_ctx);
struct sockaddr_in bss_peer[4] = {{0},};
struct sockaddr_in sgsn_peer= {0};
@@ -1497,7 +1497,7 @@ static void test_gbproxy()
static void test_gbproxy_ident_changes()
{
- struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
+ struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, tall_bsc_ctx);
struct sockaddr_in bss_peer[1] = {{0},};
struct sockaddr_in sgsn_peer= {0};
uint16_t nsei[2] = {0x1000, 0x2000};
@@ -1629,7 +1629,7 @@ static void test_gbproxy_ident_changes()
static void test_gbproxy_ra_patching()
{
- struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
+ struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, tall_bsc_ctx);
struct sockaddr_in bss_peer[1] = {{0},};
struct sockaddr_in sgsn_peer= {0};
struct gprs_ra_id rai_bss =
@@ -1657,7 +1657,7 @@ static void test_gbproxy_ra_patching()
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 };
- gbcfg.core_apn = talloc_zero_size(NULL, 100);
+ gbcfg.core_apn = talloc_zero_size(tall_bsc_ctx, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 0;
@@ -1960,6 +1960,9 @@ static void test_gbproxy_ra_patching()
OSMO_ASSERT(!expect_msg());
received_messages = NULL;
+ talloc_free(gbcfg.core_apn);
+ gbcfg.core_apn = NULL;
+
gbproxy_clear_patch_filter(&gbcfg.matches[GBPROX_MATCH_PATCHING]);
gbprox_reset(&gbcfg);
gprs_ns_destroy(nsi);
@@ -1968,7 +1971,7 @@ static void test_gbproxy_ra_patching()
static void test_gbproxy_ptmsi_assignment()
{
- struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
+ struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, tall_bsc_ctx);
struct sockaddr_in bss_peer[1] = {{0},};
struct sockaddr_in sgsn_peer= {0};
struct gprs_ra_id rai_bss =
@@ -1997,7 +2000,7 @@ static void test_gbproxy_ptmsi_assignment()
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
gbcfg.core_plmn = (struct osmo_plmn_id){};
- gbcfg.core_apn = talloc_zero_size(NULL, 100);
+ gbcfg.core_apn = talloc_zero_size(tall_bsc_ctx, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 0;
@@ -2172,6 +2175,9 @@ static void test_gbproxy_ptmsi_assignment()
dump_global(stdout, 0);
+ talloc_free(gbcfg.core_apn);
+ gbcfg.core_apn = NULL;
+
gbprox_reset(&gbcfg);
gprs_ns_destroy(nsi);
nsi = NULL;
@@ -2181,7 +2187,7 @@ static void test_gbproxy_ptmsi_assignment()
static void test_gbproxy_ptmsi_patching()
{
- struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
+ struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, tall_bsc_ctx);
struct sockaddr_in bss_peer[1] = {{0},};
struct sockaddr_in sgsn_peer= {0};
struct gprs_ra_id rai_bss =
@@ -2230,7 +2236,7 @@ static void test_gbproxy_ptmsi_patching()
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 };
- gbcfg.core_apn = talloc_zero_size(NULL, 100);
+ gbcfg.core_apn = talloc_zero_size(tall_bsc_ctx, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 1;
@@ -2508,6 +2514,9 @@ static void test_gbproxy_ptmsi_patching()
dump_global(stdout, 0);
+ talloc_free(gbcfg.core_apn);
+ gbcfg.core_apn = NULL;
+
gbprox_reset(&gbcfg);
gprs_ns_destroy(nsi);
nsi = NULL;
@@ -2517,7 +2526,7 @@ static void test_gbproxy_ptmsi_patching()
static void test_gbproxy_ptmsi_patching_bad_cases()
{
- struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
+ struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, tall_bsc_ctx);
struct sockaddr_in bss_peer[1] = {{0},};
struct sockaddr_in sgsn_peer= {0};
struct gprs_ra_id rai_bss =
@@ -2548,7 +2557,7 @@ static void test_gbproxy_ptmsi_patching_bad_cases()
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 };
- gbcfg.core_apn = talloc_zero_size(NULL, 100);
+ gbcfg.core_apn = talloc_zero_size(tall_bsc_ctx, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 1;
@@ -2686,6 +2695,9 @@ static void test_gbproxy_ptmsi_patching_bad_cases()
dump_global(stdout, 0);
+ talloc_free(gbcfg.core_apn);
+ gbcfg.core_apn = NULL;
+
gbprox_reset(&gbcfg);
gprs_ns_destroy(nsi);
nsi = NULL;
@@ -2696,7 +2708,7 @@ static void test_gbproxy_ptmsi_patching_bad_cases()
static void test_gbproxy_imsi_acquisition()
{
- struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
+ struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, tall_bsc_ctx);
struct sockaddr_in bss_peer[1] = {{0},};
struct sockaddr_in sgsn_peer= {0};
struct gprs_ra_id rai_bss =
@@ -2731,7 +2743,7 @@ static void test_gbproxy_imsi_acquisition()
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 };
- gbcfg.core_apn = talloc_zero_size(NULL, 100);
+ gbcfg.core_apn = talloc_zero_size(tall_bsc_ctx, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 1;
gbcfg.acquire_imsi = 1;
@@ -2997,6 +3009,9 @@ static void test_gbproxy_imsi_acquisition()
dump_global(stdout, 0);
+ talloc_free(gbcfg.core_apn);
+ gbcfg.core_apn = NULL;
+
gbprox_reset(&gbcfg);
gprs_ns_destroy(nsi);
nsi = NULL;
@@ -3006,7 +3021,7 @@ static void test_gbproxy_imsi_acquisition()
static void test_gbproxy_secondary_sgsn()
{
- struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
+ struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, tall_bsc_ctx);
struct sockaddr_in bss_peer[1] = {{0},};
struct sockaddr_in sgsn_peer[2]= {{0},};
struct gprs_ra_id rai_bss =
@@ -3056,7 +3071,7 @@ static void test_gbproxy_secondary_sgsn()
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 };
- gbcfg.core_apn = talloc_zero_size(NULL, 100);
+ gbcfg.core_apn = talloc_zero_size(tall_bsc_ctx, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 1;
gbcfg.acquire_imsi = 1;
@@ -3497,6 +3512,9 @@ static void test_gbproxy_secondary_sgsn()
dump_global(stdout, 0);
+ talloc_free(gbcfg.core_apn);
+ gbcfg.core_apn = NULL;
+
gbproxy_clear_patch_filter(&gbcfg.matches[GBPROX_MATCH_ROUTING]);
gbprox_reset(&gbcfg);
gprs_ns_destroy(nsi);
@@ -3507,7 +3525,7 @@ static void test_gbproxy_secondary_sgsn()
static void test_gbproxy_keep_info()
{
- struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
+ struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, tall_bsc_ctx);
struct sockaddr_in bss_peer[1] = {{0},};
struct sockaddr_in sgsn_peer= {0};
struct gprs_ra_id rai_bss =
@@ -4440,6 +4458,9 @@ static void test_gbproxy_keep_info()
dump_global(stdout, 0);
+ talloc_free(gbcfg.core_apn);
+ gbcfg.core_apn = NULL;
+
gbprox_reset(&gbcfg);
gprs_ns_destroy(nsi);
nsi = NULL;
@@ -4728,6 +4749,8 @@ static void test_gbproxy_tlli_expire(void)
}
gbproxy_clear_patch_filter(&cfg.matches[GBPROX_MATCH_PATCHING]);
gbprox_reset(&cfg);
+ /* gbprox_reset() frees the rate_ctr, but re-allocates it again. */
+ rate_ctr_group_free(cfg.ctrg);
cleanup_test();
}
@@ -4810,7 +4833,7 @@ static void test_gbproxy_imsi_matching(void)
static void test_gbproxy_stored_messages()
{
- struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
+ struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, tall_bsc_ctx);
struct sockaddr_in bss_peer[1] = {{0},};
struct sockaddr_in sgsn_peer= {0};
struct gprs_ra_id rai_bss =
@@ -4834,7 +4857,7 @@ static void test_gbproxy_stored_messages()
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
gbcfg.core_plmn = (struct osmo_plmn_id){};
- gbcfg.core_apn = talloc_zero_size(NULL, 100);
+ gbcfg.core_apn = talloc_zero_size(tall_bsc_ctx, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 0;
gbcfg.acquire_imsi = 1;
@@ -4894,6 +4917,9 @@ static void test_gbproxy_stored_messages()
dump_global(stdout, 0);
+ talloc_free(gbcfg.core_apn);
+ gbcfg.core_apn = NULL;
+
gbprox_reset(&gbcfg);
gprs_ns_destroy(nsi);
nsi = NULL;
@@ -4926,9 +4952,13 @@ static struct log_info info = {
int main(int argc, char **argv)
{
- msgb_talloc_ctx_init(NULL, 0);
+ talloc_enable_leak_report();
+ tall_bsc_ctx = talloc_named_const(NULL, 0, "gbproxy_test");
+ void *log_ctx = talloc_named_const(tall_bsc_ctx, 0, "log");
+
+ msgb_talloc_ctx_init(tall_bsc_ctx, 0);
- osmo_init_logging(&info);
+ osmo_init_logging2(log_ctx, &info);
log_set_use_color(osmo_stderr_target, 0);
log_set_print_filename(osmo_stderr_target, 0);
osmo_signal_register_handler(SS_L_NS, &test_signal, &gbcfg);
@@ -4937,7 +4967,7 @@ int main(int argc, char **argv)
log_set_log_level(osmo_stderr_target, LOGL_DEBUG);
log_set_all_filter(osmo_stderr_target, 1);
- rate_ctr_init(NULL);
+ rate_ctr_init(tall_bsc_ctx);
setlinebuf(stdout);
@@ -4955,7 +4985,15 @@ int main(int argc, char **argv)
test_gbproxy_keep_info();
test_gbproxy_tlli_expire();
test_gbproxy_stored_messages();
+ gbprox_reset(&gbcfg);
+ /* gbprox_reset() frees the rate_ctr, but re-allocates it again. */
+ rate_ctr_group_free(gbcfg.ctrg);
printf("===== GbProxy test END\n\n");
- exit(EXIT_SUCCESS);
+ talloc_free(log_ctx);
+ /* expecting root and msgb ctx, empty */
+ OSMO_ASSERT(talloc_total_blocks(tall_bsc_ctx) == 2);
+ talloc_free(tall_bsc_ctx);
+
+ return 0;
}
diff --git a/tests/gprs/gprs_test.c b/tests/gprs/gprs_test.c
index 2dcbafaf7..99e3ea519 100644
--- a/tests/gprs/gprs_test.c
+++ b/tests/gprs/gprs_test.c
@@ -130,7 +130,8 @@ static struct log_info info = {
int main(int argc, char **argv)
{
- osmo_init_logging(&info);
+ void *ctx = talloc_named_const(NULL, 0, "gprs_test");
+ osmo_init_logging2(ctx, &info);
test_8_4_2();
test_gprs_timer_enc_dec();
diff --git a/tests/gtphub/gtphub_test.c b/tests/gtphub/gtphub_test.c
index ac0223b89..2e48bb106 100644
--- a/tests/gtphub/gtphub_test.c
+++ b/tests/gtphub/gtphub_test.c
@@ -1762,8 +1762,9 @@ static struct log_info info = {
int main(int argc, char **argv)
{
- osmo_init_logging(&info);
osmo_gtphub_ctx = talloc_named_const(NULL, 0, "osmo_gtphub");
+ void *log_ctx = talloc_named_const(osmo_gtphub_ctx, 0, "log");
+ osmo_init_logging2(log_ctx, &info);
test_nr_map_basic();
test_nr_map_wrap();
@@ -1780,7 +1781,9 @@ int main(int argc, char **argv)
printf("Done\n");
talloc_report_full(osmo_gtphub_ctx, stderr);
+ talloc_free(log_ctx);
OSMO_ASSERT(talloc_total_blocks(osmo_gtphub_ctx) == 1);
+ talloc_free(osmo_gtphub_ctx);
return 0;
}
diff --git a/tests/oap/oap_client_test.c b/tests/oap/oap_client_test.c
index 7adae83ca..87d207057 100644
--- a/tests/oap/oap_client_test.c
+++ b/tests/oap/oap_client_test.c
@@ -252,8 +252,9 @@ static struct log_info info = {
int main(int argc, char **argv)
{
- msgb_talloc_ctx_init(NULL, 0);
- osmo_init_logging(&info);
+ void *ctx = talloc_named_const(NULL, 0, "oap_client_test");
+ msgb_talloc_ctx_init(ctx, 0);
+ osmo_init_logging2(ctx, &info);
OSMO_ASSERT(osmo_stderr_target);
log_set_use_color(osmo_stderr_target, 0);
diff --git a/tests/sgsn/sgsn_test.c b/tests/sgsn/sgsn_test.c
index 2fbd6e4fd..df4df3b65 100644
--- a/tests/sgsn/sgsn_test.c
+++ b/tests/sgsn/sgsn_test.c
@@ -2444,8 +2444,8 @@ int main(int argc, char **argv)
void *osmo_sgsn_ctx;
void *msgb_ctx;
- osmo_init_logging(&info);
osmo_sgsn_ctx = talloc_named_const(NULL, 0, "osmo_sgsn");
+ osmo_init_logging2(osmo_sgsn_ctx, &info);
tall_bsc_ctx = talloc_named_const(osmo_sgsn_ctx, 0, "bsc");
msgb_ctx = msgb_talloc_ctx_init(osmo_sgsn_ctx, 0);
diff --git a/tests/slhc/slhc_test.c b/tests/slhc/slhc_test.c
index bb0e26cb8..5c1331355 100644
--- a/tests/slhc/slhc_test.c
+++ b/tests/slhc/slhc_test.c
@@ -250,17 +250,20 @@ static struct log_info info = {
int main(int argc, char **argv)
{
void *ctx;
-
- osmo_init_logging(&info);
+ void *log_ctx;
ctx = talloc_named_const(NULL, 0, "slhc_ctx");
+ log_ctx = talloc_named_const(ctx, 0, "log");
+ osmo_init_logging2(log_ctx, &info);
test_slhc(ctx);
printf("Done\n");
talloc_report_full(ctx, stderr);
+ talloc_free(log_ctx);
OSMO_ASSERT(talloc_total_blocks(ctx) == 1);
+ talloc_free(ctx);
return 0;
}
diff --git a/tests/sndcp_xid/sndcp_xid_test.c b/tests/sndcp_xid/sndcp_xid_test.c
index dc6da8230..5ed695c5e 100644
--- a/tests/sndcp_xid/sndcp_xid_test.c
+++ b/tests/sndcp_xid/sndcp_xid_test.c
@@ -261,10 +261,11 @@ static struct log_info info = {
int main(int argc, char **argv)
{
void *xid_ctx;
-
- osmo_init_logging(&info);
+ void *log_ctx;
xid_ctx = talloc_named_const(NULL, 0, "xid_ctx");
+ log_ctx = talloc_named_const(xid_ctx, 0, "log");
+ osmo_init_logging2(log_ctx, &info);
test_xid_decode_realworld(xid_ctx);
test_xid_encode_decode(xid_ctx);
@@ -272,7 +273,9 @@ int main(int argc, char **argv)
printf("Done\n");
talloc_report_full(xid_ctx, stderr);
+ talloc_free(log_ctx);
OSMO_ASSERT(talloc_total_blocks(xid_ctx) == 1);
+ talloc_free(xid_ctx);
return 0;
}
diff --git a/tests/v42bis/v42bis_test.c b/tests/v42bis/v42bis_test.c
index 41d23b02c..e9c506926 100644
--- a/tests/v42bis/v42bis_test.c
+++ b/tests/v42bis/v42bis_test.c
@@ -407,11 +407,12 @@ static struct log_info info = {
int main(int argc, char **argv)
{
void *v42bis_ctx;
+ void *log_ctx;
int i;
- osmo_init_logging(&info);
-
v42bis_ctx = talloc_named_const(NULL, 0, "v42bis_ctx");
+ log_ctx = talloc_named_const(v42bis_ctx, 0, "log");
+ osmo_init_logging2(log_ctx, &info);
test_v42bis(v42bis_ctx);
@@ -423,7 +424,9 @@ int main(int argc, char **argv)
printf("Done\n");
talloc_report_full(v42bis_ctx, stderr);
+ talloc_free(log_ctx);
OSMO_ASSERT(talloc_total_blocks(v42bis_ctx) == 1);
+ talloc_free(v42bis_ctx);
return 0;
}
diff --git a/tests/xid/xid_test.c b/tests/xid/xid_test.c
index e30a14f97..89d82e999 100644
--- a/tests/xid/xid_test.c
+++ b/tests/xid/xid_test.c
@@ -142,17 +142,20 @@ static struct log_info info = {
int main(int argc, char **argv)
{
void *xid_ctx;
-
- osmo_init_logging(&info);
+ void *log_ctx;
xid_ctx = talloc_named_const(NULL, 0, "xid_ctx");
+ log_ctx = talloc_named_const(xid_ctx, 0, "log");
+ osmo_init_logging2(log_ctx, &info);
test_xid_decode(xid_ctx);
test_xid_encode(xid_ctx);
printf("Done\n");
talloc_report_full(xid_ctx, stderr);
+ talloc_free(log_ctx);
OSMO_ASSERT(talloc_total_blocks(xid_ctx) == 1);
+ talloc_free(xid_ctx);
return 0;
}