]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[netdevice] Clear network device setting before unregistering
authorMichael Brown <mcb30@ipxe.org>
Thu, 25 Oct 2012 05:44:00 +0000 (22:44 -0700)
committerMichael Brown <mcb30@ipxe.org>
Thu, 25 Oct 2012 05:44:00 +0000 (22:44 -0700)
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>
src/net/netdevice.c

index bea067521565ed8a3967f1077f9be0820078cc29..ec3456a9388f17a7f69d80b825615a0bd717aee1 100644 (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 */