summaryrefslogtreecommitdiffstats
path: root/src/core/settings.c
diff options
context:
space:
mode:
authorPiotr JaroszyƄski2010-07-14 22:25:55 +0200
committerMichael Brown2010-07-15 21:31:53 +0200
commit519a4be18951cd8cc2f5a63392ee3611a6cbea82 (patch)
tree9d092e88832fe747c806dcd9b8340db9c7baef6d /src/core/settings.c
parent[tcp] Treat ACKs as sent only when successfully transmitted (diff)
downloadipxe-519a4be18951cd8cc2f5a63392ee3611a6cbea82.tar.gz
ipxe-519a4be18951cd8cc2f5a63392ee3611a6cbea82.tar.xz
ipxe-519a4be18951cd8cc2f5a63392ee3611a6cbea82.zip
[settings] Unregister the children when unregistering the parent
The DHCP settings registered as a child of the netdevice settings are not unregistered anywhere. This prevents the netdevice from being freed on shutdown. Fix by automatically unregistering any child settings when the parent settings are unregistered. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/settings.c')
-rw-r--r--src/core/settings.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/settings.c b/src/core/settings.c
index 427b9ed6..79fb8e72 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -459,15 +459,22 @@ int register_settings ( struct settings *settings, struct settings *parent ) {
* @v settings Settings block
*/
void unregister_settings ( struct settings *settings ) {
+ struct settings *child;
+ struct settings *tmp;
+
+ /* Unregister child settings */
+ list_for_each_entry_safe ( child, tmp, &settings->children, siblings ) {
+ unregister_settings ( child );
+ }
DBGC ( settings, "Settings %p (\"%s\") unregistered\n",
settings, settings_name ( settings ) );
/* Remove from list of settings */
- ref_put ( settings->refcnt );
ref_put ( settings->parent->refcnt );
settings->parent = NULL;
list_del ( &settings->siblings );
+ ref_put ( settings->refcnt );
/* Apply potentially-updated settings */
apply_settings();