Change in libosmocore[master]: logging: do not allow multiple calls of log_init()

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/.

laforge gerrit-no-reply at lists.osmocom.org
Tue May 12 18:10:00 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/18222 )

Change subject: logging: do not allow multiple calls of log_init()
......................................................................

logging: do not allow multiple calls of log_init()

calling log_init() multiple times would lead into memory leaks. The
function should only be called once on startup of the process. Lets make
sure that it does not get called multiple times by accident.

Change-Id: Ibb300e4c9b04767581116ab530b2e6a9a195db08
---
M src/logging.c
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved
  laforge: Looks good to me, approved



diff --git a/src/logging.c b/src/logging.c
index 4aaf515..c14e696 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -1028,6 +1028,9 @@
 	int i;
 	struct log_info_cat *cat_ptr;
 
+	/* Ensure that log_init is not called multiple times */
+	OSMO_ASSERT(tall_log_ctx == NULL)
+
 	tall_log_ctx = talloc_named_const(ctx, 1, "logging");
 	if (!tall_log_ctx)
 		return -ENOMEM;

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18222
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibb300e4c9b04767581116ab530b2e6a9a195db08
Gerrit-Change-Number: 18222
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200512/7b106039/attachment.htm>


More information about the gerrit-log mailing list