buglwIP - A Lightweight TCP/IP stack - Bugs: bug #31525, dhcp_stop() should be free the...

 
 

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

bug #31525: dhcp_stop() should be free the dhcp memory, which in netif.

Submitted by:  hanhui <hanhui03>
Submitted on:  Tue 02 Nov 2010 02:36:04 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Change RequestStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: CVS Head

Sun 21 Nov 2010 01:41:31 PM UTC, comment #4:

Fixed by adding the function dhcp_cleanup(), which you would need to call before free(netif).

Thanks for reporting.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 02 Nov 2010 03:42:34 PM UTC, comment #3:

Then I'd rather vote for an extra function dhcp_cleanup() which does not affect code size if not used (since it will then be thrown away by the linker).

You can already prevent this leak by using dhcp_set_struct() to set your custom pointer and prevent dhcp_start() calling mem_malloc().

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 02 Nov 2010 03:38:14 PM UTC, comment #2:

I know that dhcp_start() checks to see if there is an existing client and reuses it if it can. But if run the following codes, it will lead to memory leaks.

struct netif netif = (struct netif )malloc(...);

......; /* Initialize network interface */
dhcp_start(netif);

......;
dhcp_release(netif);
dhcp_stop(netif);
netif_remove(netif);

free(netif);

hanhui <hanhui03>
Tue 02 Nov 2010 03:16:33 PM UTC, comment #1:

It looks like this is deliberate: dhcp_start() checks to see if there is an existing client and reuses it if it can.

Kieran Mansley <kieranm>
Project Administrator
Tue 02 Nov 2010 02:36:04 PM UTC, original submission:

dhcp_stop() should add the following code:

mem_free(netif->dhcp);
netif->dhcp = NULL;

hanhui <hanhui03>

 

No files currently attached

 

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 kieranm (Posted a comment)
  • -unavailable- added by hanhui03 (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 21 Nov 2010 01:41:31 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1