From 6472e3b35ec9b45195ecff21ca5d952ef9f84fa8 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Wed, 11 Feb 2009 20:27:00 +0000 Subject: [PATCH] fixed bug #24480 (releasing old udp_pdb and pbuf in dhcp_start) --- CHANGELOG | 3 +++ src/core/dhcp.c | 18 +++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9b73e4a3..80c54a3d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -60,6 +60,9 @@ HISTORY ++ Bugfixes: + 2009-02-11 Simon Goldschmidt + * dhcp.c: fixed bug #24480 (releasing old udp_pdb and pbuf in dhcp_start) + 2009-02-11 Simon Goldschmidt * opt.h, api_msg.c: added configurable default valud for netconn->recv_bufsize: RECV_BUFSIZE_DEFAULT (fixes bug #23726: pbuf pool exhaustion on slow recv()) diff --git a/src/core/dhcp.c b/src/core/dhcp.c index 8eb27838..1e5f0dac 100644 --- a/src/core/dhcp.c +++ b/src/core/dhcp.c @@ -586,6 +586,12 @@ dhcp_start(struct netif *netif) /* already has DHCP client attached */ } else { LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE | 3, ("dhcp_start(): restarting DHCP configuration\n")); + if (dhcp->pcb != NULL) { + udp_remove(dhcp->pcb); + } + if (dhcp->p != NULL) { + pbuf_free(dhcp->p); + } } /* clear data structure */ @@ -671,14 +677,12 @@ dhcp_inform(struct netif *netif) LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | 2, ("dhcp_inform: could not allocate DHCP request\n")); } - if (dhcp != NULL) { - if (dhcp->pcb != NULL) { - udp_remove(dhcp->pcb); - } - dhcp->pcb = NULL; - mem_free((void *)dhcp); - netif->dhcp = old_dhcp; + if (dhcp->pcb != NULL) { + udp_remove(dhcp->pcb); } + dhcp->pcb = NULL; + mem_free((void *)dhcp); + netif->dhcp = old_dhcp; } #if DHCP_DOES_ARP_CHECK