Date: Mon, 9 Apr 2018 15:29:15 +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-10@freebsd.org Subject: svn commit: r332330 - stable/10/sys/netpfil/pf Message-ID: <201804091529.w39FTFdH089686@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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++;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804091529.w39FTFdH089686>