Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dist/pf/net plug pfik_ifaddrhooks leaks by embedding it ...



details:   https://anonhg.NetBSD.org/src/rev/dde6518a4cab
branches:  trunk
changeset: 571617:dde6518a4cab
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sat Dec 04 10:35:54 2004 +0000

description:
plug pfik_ifaddrhooks leaks by embedding it to pfi_kif.

diffstat:

 sys/dist/pf/net/pf_if.c |  19 +++++--------------
 sys/dist/pf/net/pfvar.h |   4 ++--
 2 files changed, 7 insertions(+), 16 deletions(-)

diffs (68 lines):

diff -r 82761b8ffcf6 -r dde6518a4cab sys/dist/pf/net/pf_if.c
--- a/sys/dist/pf/net/pf_if.c   Sat Dec 04 08:31:54 2004 +0000
+++ b/sys/dist/pf/net/pf_if.c   Sat Dec 04 10:35:54 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pf_if.c,v 1.6 2004/11/14 11:12:16 yamt Exp $   */
+/*     $NetBSD: pf_if.c,v 1.7 2004/12/04 10:35:54 yamt Exp $   */
 /*     $OpenBSD: pf_if.c,v 1.20 2004/08/15 15:31:46 henning Exp $ */
 
 /*
@@ -216,7 +216,7 @@
            hook_establish(ifp->if_addrhooks, 1, pfi_kifaddr_update, p);
 #else
        p->pfik_ah_cookie =
-           hook_establish(p->pfik_ifaddrhooks, 1, pfi_kifaddr_update, p);
+           hook_establish(&p->pfik_ifaddrhooks, 1, pfi_kifaddr_update, p);
 #endif
        pfi_index2kif[ifp->if_index] = p;
        pfi_dohooks(p);
@@ -242,7 +242,7 @@
 #ifdef __OpenBSD__
        hook_disestablish(p->pfik_ifp->if_addrhooks, p->pfik_ah_cookie);
 #else
-       hook_disestablish(p->pfik_ifaddrhooks, p->pfik_ah_cookie);
+       hook_disestablish(&p->pfik_ifaddrhooks, p->pfik_ah_cookie);
 #endif
        q = p->pfik_parent;
        p->pfik_ifp = NULL;
@@ -616,20 +616,11 @@
                return (NULL);
        }
        bzero(p->pfik_ah_head, sizeof(*p->pfik_ah_head));
-#ifdef __NetBSD__
-       p->pfik_ifaddrhooks = malloc(sizeof(*p->pfik_ifaddrhooks), PFI_MTYPE,
-           M_DONTWAIT);
-       if (p->pfik_ifaddrhooks == NULL) {
-               free(p->pfik_ah_head, PFI_MTYPE);
-               free(p, PFI_MTYPE);
-               return (NULL);
-       }
-       bzero(p->pfik_ifaddrhooks, sizeof(*p->pfik_ifaddrhooks));
-#endif
        TAILQ_INIT(p->pfik_ah_head);
        TAILQ_INIT(&p->pfik_grouphead);
 #ifdef __NetBSD__
-       TAILQ_INIT(p->pfik_ifaddrhooks);
+       bzero(&p->pfik_ifaddrhooks, sizeof(p->pfik_ifaddrhooks));
+       TAILQ_INIT(&p->pfik_ifaddrhooks);
 #endif
        strlcpy(p->pfik_name, name, sizeof(p->pfik_name));
        RB_INIT(&p->pfik_lan_ext);
diff -r 82761b8ffcf6 -r dde6518a4cab sys/dist/pf/net/pfvar.h
--- a/sys/dist/pf/net/pfvar.h   Sat Dec 04 08:31:54 2004 +0000
+++ b/sys/dist/pf/net/pfvar.h   Sat Dec 04 10:35:54 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pfvar.h,v 1.6 2004/11/14 11:12:16 yamt Exp $   */
+/*     $NetBSD: pfvar.h,v 1.7 2004/12/04 10:35:54 yamt Exp $   */
 /*     $OpenBSD: pfvar.h,v 1.202 2004/07/12 00:50:22 itojun Exp $ */
 
 /*
@@ -843,7 +843,7 @@
        int                              pfik_states;
        int                              pfik_rules;
 #ifdef __NetBSD__
-       struct hook_desc_head           *pfik_ifaddrhooks;
+       struct hook_desc_head            pfik_ifaddrhooks;
 #endif
 };
 #define pfik_name      pfik_if.pfif_name



Home | Main Index | Thread Index | Old Index