Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2018 16:26:49 +0000 (UTC)
From:      David Bright <dab@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r330661 - stable/11/usr.sbin/syslogd
Message-ID:  <201803081626.w28GQnFw032261@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dab
Date: Thu Mar  8 16:26:49 2018
New Revision: 330661
URL: https://svnweb.freebsd.org/changeset/base/330661

Log:
  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 <sreeramabs@yahoo.com>
  Reported by:	Sreeram <sreeramabs@yahoo.com>
  Sponsored by:	Dell EMC

Modified:
  stable/11/usr.sbin/syslogd/syslogd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/syslogd/syslogd.c
==============================================================================
--- stable/11/usr.sbin/syslogd/syslogd.c	Thu Mar  8 16:19:01 2018	(r330660)
+++ stable/11/usr.sbin/syslogd/syslogd.c	Thu Mar  8 16:26:49 2018	(r330661)
@@ -170,7 +170,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 {
@@ -363,10 +363,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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803081626.w28GQnFw032261>