[MERGED] openbsc[master]: msgb talloc ctx: initialize in all main() scopes

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Oct 13 13:14:41 UTC 2016


Neels Hofmeyr has submitted this change and it was merged.

Change subject: msgb talloc ctx: initialize in all main() scopes
......................................................................


msgb talloc ctx: initialize in all main() scopes

Add msgb_talloc_ctx_init() call to many main() functions still lacking a
msgb talloc context.

Change-Id: Ib0d6751260659cabf18a7ce80680ba2fb4228ea1
---
M openbsc/src/gprs/gtphub_main.c
M openbsc/src/ipaccess/ipaccess-config.c
M openbsc/src/ipaccess/ipaccess-proxy.c
M openbsc/src/osmo-bsc/osmo_bsc_main.c
M openbsc/src/osmo-bsc_mgcp/mgcp_main.c
M openbsc/src/utils/bs11_config.c
M openbsc/src/utils/meas_udp2db.c
M openbsc/src/utils/meas_vis.c
M openbsc/src/utils/smpp_mirror.c
M openbsc/tests/bsc-nat/bsc_nat_test.c
M openbsc/tests/bsc/bsc_test.c
M openbsc/tests/gbproxy/gbproxy_test.c
M openbsc/tests/mgcp/mgcp_test.c
M openbsc/tests/oap/oap_test.c
M openbsc/tests/trau/trau_test.c
15 files changed, 20 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/openbsc/src/gprs/gtphub_main.c b/openbsc/src/gprs/gtphub_main.c
index 1e20a63..46360f9 100644
--- a/openbsc/src/gprs/gtphub_main.c
+++ b/openbsc/src/gprs/gtphub_main.c
@@ -299,6 +299,7 @@
 	struct gtphub *hub = &_hub;
 
 	osmo_gtphub_ctx = talloc_named_const(NULL, 0, "osmo_gtphub");
+	msgb_talloc_ctx_init(osmo_gtphub_ctx, 0);
 
 	signal(SIGINT, &signal_handler);
 	signal(SIGABRT, &signal_handler);
diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c
index 453877b..3c2d6cc 100644
--- a/openbsc/src/ipaccess/ipaccess-config.c
+++ b/openbsc/src/ipaccess/ipaccess-config.c
@@ -853,6 +853,7 @@
 	int rc, option_index = 0, stream_id = 0xff;
 
 	tall_ctx_config = talloc_named_const(NULL, 0, "ipaccess-config");
+	msgb_talloc_ctx_init(tall_ctx_config, 0);
 
 	osmo_init_logging(&log_info);
 	log_parse_category_mask(osmo_stderr_target, "DNM,0");
diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c
index 4077b3f..52e77e8 100644
--- a/openbsc/src/ipaccess/ipaccess-proxy.c
+++ b/openbsc/src/ipaccess/ipaccess-proxy.c
@@ -1200,6 +1200,7 @@
 	int rc;
 
 	tall_bsc_ctx = talloc_named_const(NULL, 1, "ipaccess-proxy");
+	msgb_talloc_ctx_init(tall_bsc_ctx, 0);
 
 	osmo_init_logging(&log_info);
 	log_parse_category_mask(osmo_stderr_target, "DLINP:DLMI");
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c
index d3128e4..daab55b 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_main.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c
@@ -192,6 +192,7 @@
 	int rc;
 
 	tall_bsc_ctx = talloc_named_const(NULL, 1, "openbsc");
+	msgb_talloc_ctx_init(tall_bsc_ctx, 0);
 
 	osmo_init_logging(&log_info);
 	osmo_stats_init(tall_bsc_ctx);
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
index ac55e25..964768e 100644
--- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
+++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
@@ -203,6 +203,7 @@
 	int on = 1, rc;
 
 	tall_bsc_ctx = talloc_named_const(NULL, 1, "mgcp-callagent");
+	msgb_talloc_ctx_init(tall_bsc_ctx, 0);
 
 	osmo_init_ignore_signals();
 	osmo_init_logging(&log_info);
diff --git a/openbsc/src/utils/bs11_config.c b/openbsc/src/utils/bs11_config.c
index 3420991..7356b82 100644
--- a/openbsc/src/utils/bs11_config.c
+++ b/openbsc/src/utils/bs11_config.c
@@ -891,6 +891,7 @@
 	struct e1inp_line *line;
 
 	tall_bs11cfg_ctx = talloc_named_const(NULL, 0, "bs11-config");
+	msgb_talloc_ctx_init(tall_bs11cfg_ctx, 0);
 
 	osmo_init_logging(&log_info);
 	handle_options(argc, argv);
diff --git a/openbsc/src/utils/meas_udp2db.c b/openbsc/src/utils/meas_udp2db.c
index 4a07217..5032d0c 100644
--- a/openbsc/src/utils/meas_udp2db.c
+++ b/openbsc/src/utils/meas_udp2db.c
@@ -90,6 +90,8 @@
 	char *db_fname;
 	int rc;
 
+	msgb_talloc_ctx_init(NULL, 0);
+
 	if (argc < 2) {
 		fprintf(stderr, "You have to specify the database file name\n");
 		exit(2);
diff --git a/openbsc/src/utils/meas_vis.c b/openbsc/src/utils/meas_vis.c
index 4f7e632..061a7a4 100644
--- a/openbsc/src/utils/meas_vis.c
+++ b/openbsc/src/utils/meas_vis.c
@@ -264,6 +264,8 @@
 	char *header[1];
 	char *title[1];
 
+	msgb_talloc_ctx_init(NULL, 0);
+
 	printf("sizeof(gsm_meas_rep)=%u\n", sizeof(struct gsm_meas_rep));
 	printf("sizeof(meas_feed_meas)=%u\n", sizeof(struct meas_feed_meas));
 
diff --git a/openbsc/src/utils/smpp_mirror.c b/openbsc/src/utils/smpp_mirror.c
index 2f154db..95df5f2 100644
--- a/openbsc/src/utils/smpp_mirror.c
+++ b/openbsc/src/utils/smpp_mirror.c
@@ -302,6 +302,8 @@
 	int port = 0;
 	int rc;
 
+	msgb_talloc_ctx_init(NULL, 0);
+
 	memset(&esme, 0, sizeof(esme));
 
 	osmo_init_logging(&log_info);
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index b531c6b..2914a01 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -1551,6 +1551,7 @@
 
 int main(int argc, char **argv)
 {
+	msgb_talloc_ctx_init(NULL, 0);
 	sccp_set_log_area(DSCCP);
 	osmo_init_logging(&log_info);
 
diff --git a/openbsc/tests/bsc/bsc_test.c b/openbsc/tests/bsc/bsc_test.c
index cc45652..6d41941 100644
--- a/openbsc/tests/bsc/bsc_test.c
+++ b/openbsc/tests/bsc/bsc_test.c
@@ -199,6 +199,7 @@
 
 int main(int argc, char **argv)
 {
+	msgb_talloc_ctx_init(NULL, 0);
 	osmo_init_logging(&log_info);
 
 	test_scan();
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c
index a2ff95b..b32ccb5 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.c
+++ b/openbsc/tests/gbproxy/gbproxy_test.c
@@ -4842,6 +4842,8 @@
 
 int main(int argc, char **argv)
 {
+	msgb_talloc_ctx_init(NULL, 0);
+
 	osmo_init_logging(&info);
 	log_set_use_color(osmo_stderr_target, 0);
 	log_set_print_filename(osmo_stderr_target, 0);
diff --git a/openbsc/tests/mgcp/mgcp_test.c b/openbsc/tests/mgcp/mgcp_test.c
index 6c94002..e2dc8fa 100644
--- a/openbsc/tests/mgcp/mgcp_test.c
+++ b/openbsc/tests/mgcp/mgcp_test.c
@@ -1202,6 +1202,7 @@
 
 int main(int argc, char **argv)
 {
+	msgb_talloc_ctx_init(NULL, 0);
 	osmo_init_logging(&log_info);
 
 	test_strline();
diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c
index 339d774..d200ed2 100644
--- a/openbsc/tests/oap/oap_test.c
+++ b/openbsc/tests/oap/oap_test.c
@@ -234,6 +234,7 @@
 
 int main(int argc, char **argv)
 {
+	msgb_talloc_ctx_init(NULL, 0);
 	osmo_init_logging(&info);
 
 	test_oap_api();
diff --git a/openbsc/tests/trau/trau_test.c b/openbsc/tests/trau/trau_test.c
index b95f1e8..c74e6db 100644
--- a/openbsc/tests/trau/trau_test.c
+++ b/openbsc/tests/trau/trau_test.c
@@ -66,6 +66,8 @@
 	unsigned char data[33];
 	int i;
 
+	msgb_talloc_ctx_init(NULL, 0);
+
 	memset(data, 0x00, sizeof(data));
 	test_trau_fr_efr(data);
 	memset(data, 0xff, sizeof(data));

-- 
To view, visit https://gerrit.osmocom.org/1052
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib0d6751260659cabf18a7ce80680ba2fb4228ea1
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list