summaryrefslogtreecommitdiff
path: root/sys/net/pf_table.c
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2015-04-09 12:04:15 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2015-04-09 12:04:15 +0000
commit39b463e0f6136441edb917784cd26c6c6257db14 (patch)
treeb2db683afd3113d68f2b2097912aca3f2b76222b /sys/net/pf_table.c
parent1ae9d8950842981ade038a1108f71c5e4122f31b (diff)
Plug a memory leak in pfr_destroy_kentry
pfi_kif objects allocated for table entries created by route-to or by specifying weight weren't garbage collected when the table entry was destroyed. Spotted by Alexandr Nedvedicky <alexandr ! nedvedicky at oracle ! com>, thanks! Ok henning, florian
Diffstat (limited to 'sys/net/pf_table.c')
-rw-r--r--sys/net/pf_table.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c
index 950b73a0a2c..81378621bd9 100644
--- a/sys/net/pf_table.c
+++ b/sys/net/pf_table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_table.c,v 1.107 2015/04/08 14:19:28 mikeb Exp $ */
+/* $OpenBSD: pf_table.c,v 1.108 2015/04/09 12:04:14 mikeb Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -877,6 +877,9 @@ pfr_destroy_kentry(struct pfr_kentry *ke)
{
if (ke->pfrke_counters)
pool_put(&pfr_kcounters_pl, ke->pfrke_counters);
+ if (ke->pfrke_type == PFRKE_COST || ke->pfrke_type == PFRKE_ROUTE)
+ pfi_kif_unref(((struct pfr_kentry_all *)ke)->pfrke_rkif,
+ PFI_KIF_REF_ROUTE);
pool_put(&pfr_kentry_pl[ke->pfrke_type], ke);
}