Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Apr 2018 15:11:17 +0000 (UTC)
From:      Kristof Provost <kp@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: r332328 - stable/11/sys/netpfil/pf
Message-ID:  <201804091511.w39FBHOe082550@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kp
Date: Mon Apr  9 15:11:17 2018
New Revision: 332328
URL: https://svnweb.freebsd.org/changeset/base/332328

Log:
  MFC r331225:
  
  pf: Fix memory leak in DIOCRADDTABLES
  
  If a user attempts to add two tables with the same name the duplicate table
  will not be added, but we forgot to free the duplicate table, leaking memory.
  Ensure we free the duplicate table in the error path.
  
  Reported by:	Coverity
  CID:		1382111

Modified:
  stable/11/sys/netpfil/pf/pf_table.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/pf/pf_table.c
==============================================================================
--- stable/11/sys/netpfil/pf/pf_table.c	Mon Apr  9 14:05:43 2018	(r332327)
+++ stable/11/sys/netpfil/pf/pf_table.c	Mon Apr  9 15:11:17 2018	(r332328)
@@ -1124,8 +1124,10 @@ pfr_add_tables(struct pfr_table *tbl, int size, int *n
 			if (p == NULL)
 				senderr(ENOMEM);
 			SLIST_FOREACH(q, &addq, pfrkt_workq) {
-				if (!pfr_ktable_compare(p, q))
+				if (!pfr_ktable_compare(p, q)) {
+					pfr_destroy_ktable(p, 0);
 					goto _skip;
+				}
 			}
 			SLIST_INSERT_HEAD(&addq, p, pfrkt_workq);
 			xadd++;



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