From 3d8b47fc5cbaf37fc86ace23a69c2f99910a0192 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 5 Mar 2018 15:46:38 +0100 Subject: fix logging talloc ctx: add osmo_init_logging2() Deprecate osmo_init_logging() for the benefit of adding an explicit talloc context argument to new function osmo_init_logging2(). Pass a ctx to log_init() instead of hardcoded NULL. Before now, *all* of our code uses a NULL ctx for logging, which amounts to talloc "leaks" hit by address sanitizer builds on newer gcc (e.g. gcc 7.3.0 on debian 9). This commit helps fixing "leaks" detected in e.g. osmo-bsc unit tests by a sanitize build with gcc (Debian 7.3.0-12) 7.3.0. Change-Id: I216837780e9405fdaec8059c63d10699c695b360 --- include/osmocom/core/application.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/osmocom/core/application.h b/include/osmocom/core/application.h index 266fa9bb..edf59ed4 100644 --- a/include/osmocom/core/application.h +++ b/include/osmocom/core/application.h @@ -1,5 +1,7 @@ #pragma once +#include + /*! * \file application.h * Routines for helping with the osmocom application setup. @@ -15,6 +17,8 @@ struct log_target; extern struct log_target *osmo_stderr_target; void osmo_init_ignore_signals(void); -int osmo_init_logging(const struct log_info *); +int osmo_init_logging(const struct log_info *) + OSMO_DEPRECATED("use osmo_init_logging2() instead to avoid a NULL talloc ctx"); +int osmo_init_logging2(void *ctx, const struct log_info *log_info); int osmo_daemonize(void); -- cgit v1.2.3