From 70b05cc3076b3e7c2544f53b766437f1e690c344 Mon Sep 17 00:00:00 2001 From: dab Date: Thu, 8 Mar 2018 17:14:16 +0000 Subject: [PATCH] MFC r330034 Fix a memory leak in syslogd A memory leak in syslogd for processing of forward actions was reported. This modification adapts the patch submitted with that bug to fix the leak. PR: 198385 Submitted by: Sreeram Reported by: Sreeram Sponsored by: Dell EMC git-svn-id: svn://svn.freebsd.org/base/stable/10@330664 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/syslogd/syslogd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 2e16c57a0..96086b6ef 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -161,7 +161,7 @@ STAILQ_HEAD(, funix) funixes = { &funix_default, * This structure represents the files that will have log * copies printed. * We require f_file to be valid if f_type is F_FILE, F_CONSOLE, F_TTY - * or if f_type if F_PIPE and f_pid > 0. + * or if f_type is F_PIPE and f_pid > 0. */ struct filed { @@ -353,10 +353,16 @@ close_filed(struct filed *f) return; switch (f->f_type) { + case F_FORW: + if (f->f_un.f_forw.f_addr) { + freeaddrinfo(f->f_un.f_forw.f_addr); + f->f_un.f_forw.f_addr = NULL; + } + /*FALLTHROUGH*/ + case F_FILE: case F_TTY: case F_CONSOLE: - case F_FORW: f->f_type = F_UNUSED; break; case F_PIPE: -- 2.42.0