From a4d910b347319b50b2a78261b72e96aea3cf81c1 Mon Sep 17 00:00:00 2001 From: zhangyanjiao Date: Thu, 19 Jul 2018 18:13:13 +0800 Subject: [PATCH] Release DHCP structure memory when netif is down --- src/core/netif.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/core/netif.c b/src/core/netif.c index de10eec4..e9a7036d 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -429,6 +429,18 @@ netif_remove(struct netif *netif) netif_set_down(netif); } +#if ESP_LWIP +#if LWIP_DHCP + /* netif not under DHCP control by default */ + struct dhcp *dhcp; + dhcp = netif_dhcp_data(netif); + if (dhcp) { + free(dhcp); + dhcp = NULL; + } +#endif /* LWIP_DHCP */ +#endif + mib2_remove_ip4(netif); /* this netif is default? */