Config: D-Bus core: Fix hook removal
Make sure we properly initialise the entire hook when adding it, and bust out when we're done removing.
This commit is contained in:
parent
89f628394f
commit
0a31db14b7
|
@ -200,6 +200,8 @@ config_dbus_core_add_hook(struct config_dbus_core_hook *hook)
|
|||
|
||||
for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next)
|
||||
;
|
||||
|
||||
hook->next = NULL;
|
||||
*prev = hook;
|
||||
|
||||
/* If we're already connected, call the connect hook. */
|
||||
|
@ -215,8 +217,10 @@ config_dbus_core_remove_hook(struct config_dbus_core_hook *hook)
|
|||
struct config_dbus_core_hook **prev;
|
||||
|
||||
for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next) {
|
||||
if (*prev == hook)
|
||||
if (*prev == hook) {
|
||||
*prev = hook->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user