I have come up with this change when debugging netdevices not being
free()d on shutdown(). The dhcppkt->settings registered in
dhcp_request_rx() with netdev's settings as parent are not unregistered
anywhere. That makes the netdevice's refcnt to stay >=0.
Apart from that it also just seems to make sense to not leave parentless
children settings around.
---
src/core/settings.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/core/settings.c b/src/core/settings.c
index 963bfd5..93ed2ea 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -459,15 +459,21 @@ 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;
+
+ 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();
--
1.7.1
_______________________________________________
gPXE-devel mailing list
[email protected]
http://etherboot.org/mailman/listinfo/gpxe-devel