git: c2e340452c14 - main - mcast: fix leaked igmp packets on multicast cleanup

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Thu, 14 Dec 2023 22:00:01 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=c2e340452c147b551180f2a1600ae76491342b0e

commit c2e340452c147b551180f2a1600ae76491342b0e
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2023-12-13 12:32:08 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2023-12-14 21:06:01 +0000

    mcast: fix leaked igmp packets on multicast cleanup
    
    When we release a multicast address (e.g. on interface shutdown) we may
    still have packets queued in inm_scq. We have to free those, or we'll
    leak memory.
    
    Reviewed by:    glebius
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D43033
---
 sys/netinet/in_mcast.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c
index cae15bc4108a..6d68ebcb188c 100644
--- a/sys/netinet/in_mcast.c
+++ b/sys/netinet/in_mcast.c
@@ -1180,6 +1180,7 @@ inm_purge(struct in_multi *inm)
 		free(ims, M_IPMSOURCE);
 		inm->inm_nsrc--;
 	}
+	mbufq_drain(&inm->inm_scq);
 }
 
 /*