david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[netdevice] Clear network device setting before unregistering

Avoid memory leaks by clearing any (non-child) settings immediately
before unregistering the network device settings block.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2012-10-24 22:44:00 -07:00
parent 34863a51c2
commit 88e19fcda9
1 changed files with 2 additions and 0 deletions

View File

@ -486,6 +486,7 @@ int register_netdev ( struct net_device *netdev ) {
err_probe:
for_each_table_entry_continue_reverse ( driver, NET_DRIVERS )
driver->remove ( netdev );
clear_settings ( netdev_settings ( netdev ) );
unregister_settings ( netdev_settings ( netdev ) );
err_register_settings:
return rc;
@ -570,6 +571,7 @@ void unregister_netdev ( struct net_device *netdev ) {
driver->remove ( netdev );
/* Unregister per-netdev configuration settings */
clear_settings ( netdev_settings ( netdev ) );
unregister_settings ( netdev_settings ( netdev ) );
/* Remove from device list */