svn commit: r332330 - stable/10/sys/netpfil/pf

Kristof Provost kp at FreeBSD.org
Mon Apr 9 15:29:15 UTC 2018


Author: kp
Date: Mon Apr  9 15:29:14 2018
New Revision: 332330
URL: https://svnweb.freebsd.org/changeset/base/332330

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/10/sys/netpfil/pf/pf_table.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netpfil/pf/pf_table.c
==============================================================================
--- stable/10/sys/netpfil/pf/pf_table.c	Mon Apr  9 15:21:40 2018	(r332329)
+++ stable/10/sys/netpfil/pf/pf_table.c	Mon Apr  9 15:29:14 2018	(r332330)
@@ -1123,8 +1123,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++;


More information about the svn-src-all mailing list