diff options
author | Michael Brown <mcb30@ipxe.org> | 2012-10-24 22:44:00 -0700 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2012-10-24 22:44:00 -0700 |
commit | 88e19fcda95fa1ea59d262898001207c4406eb6d (patch) | |
tree | da7f62de0b131854be90925536c04e8589a30ab6 | |
parent | 34863a51c27164fd9a9f83dda45ff2a79131c42e (diff) | |
download | ipxe-88e19fcda95fa1ea59d262898001207c4406eb6d.zip ipxe-88e19fcda95fa1ea59d262898001207c4406eb6d.tar.gz ipxe-88e19fcda95fa1ea59d262898001207c4406eb6d.tar.bz2 |
[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>
-rw-r--r-- | src/net/netdevice.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c index bea0675..ec3456a 100644 --- a/src/net/netdevice.c +++ b/src/net/netdevice.c @@ -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 */ |