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

Submitted by:  Benjamin Silvestre <bsilvestre>
Submitted on:  Tue 07 Oct 2008 05:35:13 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned 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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>

 

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
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by bsilvestre (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 11 Feb 2009 08:28:33 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed
    Tue 07 Oct 2008 05:35:14 PM UTCbsilvestreAttached File-=>Added dhcp_diff, #16625

    Back to the top


    Powered by Savane 3.1-cleanup1