Skip to content

Commit

Permalink
[netdevice] Clear network device setting before unregistering
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mcb30 committed Oct 25, 2012
1 parent 34863a5 commit 88e19fc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/net/netdevice.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 88e19fc

Please sign in to comment.