From c73d8f324d14c2433d2a59724c2ea4ff7a9ea979 Mon Sep 17 00:00:00 2001 From: yinbin Date: Mon, 14 Oct 2024 15:45:07 +0800 Subject: [PATCH] IPV6: add group check while mld6 schedule a report --- src/core/ipv6/mld6.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/ipv6/mld6.c b/src/core/ipv6/mld6.c index 3aecb35..ffa2faf 100644 --- a/src/core/ipv6/mld6.c +++ b/src/core/ipv6/mld6.c @@ -292,11 +292,14 @@ mld6_input(struct pbuf *p, struct netif *inp) ip6_addr_copy(group_addr, mld_v2_hdr->multicast_address); group = mld6_lookfor_group(inp, &group_addr); + if (group == NULL) { + MLD6_STATS_INC(mld6.drop); + break; + } + if (0 == src_num) { - if (group != NULL) { - /* Schedule a report. */ - mld6_v2_delayed_report(group, lwip_ntohs(mld_v2_hdr->max_resp_delay)); - } + /* Schedule a report. */ + mld6_v2_delayed_report(group, lwip_ntohs(mld_v2_hdr->max_resp_delay)); } else { src_buf = (ip6_addr_p_t *)mem_malloc(src_buf_size); if (src_buf == NULL) { @@ -310,6 +313,7 @@ mld6_input(struct pbuf *p, struct netif *inp) /* We interest! */ mld6_v2_delayed_report(group, lwip_ntohs(mld_v2_hdr->max_resp_delay)); } + mem_free(src_buf); } } } -- 2.34.1