buglwIP - A Lightweight TCP/IP stack - Bugs: bug #24480, Unreleased memory in DHCP

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #24480: Unreleased memory in DHCP

Submitter:  Benjamin Silvestre <bsilvestre>
Submitted:  Tue 07 Oct 2008 05:35:13 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.3.0

Wed 11 Feb 2009 08:28:33 PM UTC, comment #2: 

Ah hell, I've checked in something like the fix you suggested: it is an 'externally' visible part of the API and open to wrong usage, so it's only fair to protect users from memory leaks (even when using the API in a sligthly wrong way).

Simon Goldschmidt <goldsimon>
Group administrator
Wed 11 Feb 2009 07:18:53 PM UTC, comment #1: 

Sorry it took so long to react, but out of interest, why doesn't calling dhcp_stop before restarting fix the problem? The only thing dhcp_stop really does is deallocating the udp_pcb and freeing the struct dhcp...

I agree we should free the old pcb or assert, though...

Simon Goldschmidt <goldsimon>
Group administrator
Tue 07 Oct 2008 05:35:13 PM UTC, original submission:  

I use the atmel's avr32 port.
In dhcp_start (dhcp.c) when a client is already attached, pcb and p  members are not destroyed. This leak leads to an unworking dhcp after few starts (with, in my case, no more udp pcb available).

Calling dhcp_release or/and dhcp_stop before restarting dhcp don't fix the problem.

So I add udp_remove and pbuf_free when a client is already attached. This simple workaround works fine for me:
(file dhcp.c after line 586, see dhcp_diff enclosed)
  if (dhcp->pcb != NULL) {
udp_remove(dhcp->pcb);
dhcp->pcb = NULL;
    }
    if (dhcp->p != NULL) {
pbuf_free(dhcp->p);
dhcp->p = NULL;
    }

Regards,
Benjamin


Benjamin Silvestre <bsilvestre>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #16625:  dhcp_diff added by bsilvestre (439B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by bsilvestre (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-02-11 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2008-10-07 bsilvestre Attached File- Added dhcp_diff, #16625

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code