From 52275154de2486e9302dba60516b8c46898a67ec Mon Sep 17 00:00:00 2001 From: Julius Pfrommer Date: Wed, 21 Feb 2024 00:31:05 +0100 Subject: [PATCH] fix(examples): Remove a memleak in the logger handling in server_loglevel.c --- examples/server_loglevel.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/server_loglevel.c b/examples/server_loglevel.c index 5b433d25a65..39083b37345 100644 --- a/examples/server_loglevel.c +++ b/examples/server_loglevel.c @@ -46,12 +46,15 @@ int main(int argc, char **argv) { } #endif - UA_Logger logger = UA_Log_Stdout_withLevel( log_level ); UA_Server *server = UA_Server_new(); UA_ServerConfig *config = UA_Server_getConfig(server); UA_ServerConfig_setDefault(config); - config->logging = &logger; + + /* Exchange the logger */ + UA_Logger logger = UA_Log_Stdout_withLevel( log_level ); + logger.clear = config->logging->clear; + *config->logging = logger; /* Some data */ UA_StatusCode retval;