mcast: fix memory leak in imf_purge()

The IGMP code buffers packets in the imf_inm->inm_scq mbufq, but does
not clear this queue when struct in_mfilter is freed by imf_purge().
This can cause memory leaks if IGMPv3 is used.

Purge the mbufq on imf_purge().

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D41629
This commit is contained in:
Kristof Provost 2023-08-29 11:33:17 +02:00
parent 8d49fd7331
commit fa03d37432
1 changed files with 2 additions and 0 deletions

View File

@ -915,6 +915,8 @@ imf_purge(struct in_mfilter *imf)
imf->imf_st[0] = imf->imf_st[1] = MCAST_UNDEFINED;
KASSERT(RB_EMPTY(&imf->imf_sources),
("%s: imf_sources not empty", __func__));
if (imf->imf_inm != NULL)
mbufq_drain(&imf->imf_inm->inm_scq);
}
/*