mirror of
https://github.com/espressif/esp-lwip.git
synced 2026-11-12 01:11:08 +00:00
bugfix: fix IPv6 memory leak issue
This commit is contained in:
@@ -452,6 +452,7 @@ ip6_input(struct pbuf *p, struct netif *inp)
|
||||
if (ip6_addr_isipv4mappedipv6(ip_2_ip6(&ip_data.current_iphdr_dest)) ||
|
||||
ip6_addr_isipv4mappedipv6(ip_2_ip6(&ip_data.current_iphdr_src)) ||
|
||||
ip6_addr_ismulticast(ip_2_ip6(&ip_data.current_iphdr_src))) {
|
||||
pbuf_free(p);
|
||||
IP6_STATS_INC(ip6.err);
|
||||
IP6_STATS_INC(ip6.drop);
|
||||
return ERR_OK;
|
||||
|
||||
+3
-4
@@ -504,7 +504,7 @@ pbuf_realloc(struct pbuf *p, u16_t new_len)
|
||||
{
|
||||
struct pbuf *q;
|
||||
u16_t rem_len; /* remaining length */
|
||||
s32_t grow;
|
||||
u16_t shrink;
|
||||
|
||||
LWIP_ASSERT("pbuf_realloc: p != NULL", p != NULL);
|
||||
LWIP_ASSERT("pbuf_realloc: sane p->type", p->type == PBUF_POOL ||
|
||||
@@ -520,7 +520,7 @@ pbuf_realloc(struct pbuf *p, u16_t new_len)
|
||||
|
||||
/* the pbuf chain grows by (new_len - p->tot_len) bytes
|
||||
* (which may be negative in case of shrinking) */
|
||||
grow = new_len - p->tot_len;
|
||||
shrink = (u16_t)(p->tot_len - new_len);
|
||||
|
||||
/* first, step over any pbufs that should remain in the chain */
|
||||
rem_len = new_len;
|
||||
@@ -530,8 +530,7 @@ pbuf_realloc(struct pbuf *p, u16_t new_len)
|
||||
/* decrease remaining length by pbuf length */
|
||||
rem_len -= q->len;
|
||||
/* decrease total length indicator */
|
||||
LWIP_ASSERT("grow < max_u16_t", grow < 0xffff);
|
||||
q->tot_len += (u16_t)grow;
|
||||
q->tot_len = (u16_t)(q->tot_len - shrink);
|
||||
/* proceed to next pbuf in chain */
|
||||
q = q->next;
|
||||
LWIP_ASSERT("pbuf_realloc: q != NULL", q != NULL);
|
||||
|
||||
Reference in New Issue
Block a user