Browse Source

[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>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
88e19fcda9
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      src/net/netdevice.c

+ 2
- 0
src/net/netdevice.c View File

@@ -486,6 +486,7 @@ int register_netdev ( struct net_device *netdev ) {
486 486
  err_probe:
487 487
 	for_each_table_entry_continue_reverse ( driver, NET_DRIVERS )
488 488
 		driver->remove ( netdev );
489
+	clear_settings ( netdev_settings ( netdev ) );
489 490
 	unregister_settings ( netdev_settings ( netdev ) );
490 491
  err_register_settings:
491 492
 	return rc;
@@ -570,6 +571,7 @@ void unregister_netdev ( struct net_device *netdev ) {
570 571
 		driver->remove ( netdev );
571 572
 
572 573
 	/* Unregister per-netdev configuration settings */
574
+	clear_settings ( netdev_settings ( netdev ) );
573 575
 	unregister_settings ( netdev_settings ( netdev ) );
574 576
 
575 577
 	/* Remove from device list */

Loading…
Cancel
Save