diff options
author | jinmei <jinmei@FreeBSD.org> | 2007-06-02 08:02:36 +0000 |
---|---|---|
committer | jinmei <jinmei@FreeBSD.org> | 2007-06-02 08:02:36 +0000 |
commit | 6d89652bc0f7d0aaa4494c739108f5adc374a1bc (patch) | |
tree | 9374c84240bd596492283f33131f2a6e2b672d38 /sys/netinet6/in6_ifattach.c | |
parent | ac701ac964be6305982bbc81a67581b4fc708ec2 (diff) | |
download | FreeBSD-src-6d89652bc0f7d0aaa4494c739108f5adc374a1bc.zip FreeBSD-src-6d89652bc0f7d0aaa4494c739108f5adc374a1bc.tar.gz |
fixed memory leak for IPv6 multicast membership information associated
with interface addresses.
Approved by: gnn (mentor)
MFC after: 1 week
Diffstat (limited to 'sys/netinet6/in6_ifattach.c')
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 55ae4f2..b78b5c9 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -731,8 +731,8 @@ in6_ifdetach(ifp) struct rtentry *rt; short rtflags; struct sockaddr_in6 sin6; - struct in6_multi *in6m; - struct in6_multi *in6m_next; + struct in6_multi *in6m, *in6m_next; + struct in6_multi_mship *imm; /* remove neighbor management table */ nd6_purge(ifp); @@ -756,6 +756,14 @@ in6_ifdetach(ifp) ia = (struct in6_ifaddr *)ifa; + /* + * leave from multicast groups we have joined for the interface + */ + while ((imm = ia->ia6_memberships.lh_first) != NULL) { + LIST_REMOVE(imm, i6mm_chain); + in6_leavegroup(imm); + } + /* remove from the routing table */ if ((ia->ia_flags & IFA_ROUTE) && (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0, 0UL))) { |