Skip to content

Commit

Permalink
Merge pull request #14773 from LabNConsulting/fix-log-vty-memleak
Browse files Browse the repository at this point in the history
lib: free the log file resources created at startup and config
  • Loading branch information
donaldsharp authored Nov 11, 2023
2 parents 07b99d6 + d8042cb commit 3444565
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/log_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,24 @@ void log_config_write(struct vty *vty)
}
}

static int log_vty_fini(void)
{
if (zt_file_cmdline.filename)
zlog_file_fini(&zt_file_cmdline);
if (zt_file.filename)
zlog_file_fini(&zt_file);
return 0;
}


static int log_vty_init(const char *progname, const char *protoname,
unsigned short instance, uid_t uid, gid_t gid)
{
zlog_progname = progname;
zlog_protoname = protoname;

hook_register(zlog_fini, log_vty_fini);

zlog_set_prefix_ec(true);
zlog_set_prefix_xid(true);

Expand Down

0 comments on commit 3444565

Please sign in to comment.