Skip to content

Commit

Permalink
fix(examples): Remove a memleak in the logger handling in server_logl…
Browse files Browse the repository at this point in the history
…evel.c
  • Loading branch information
jpfr committed Feb 20, 2024
1 parent 0e74150 commit f7b2197
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/server_loglevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f7b2197

Please sign in to comment.