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.

Submitter:  hanhui <hanhui03>
Submitted:  Tue 02 Nov 2010 02:36:04 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned 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>
Group administrator
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>
Group administrator
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>
Group Member
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>

 

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

No files currently attached

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2010-11-21 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code