From 0a31db14b7c7c21ef550dbcc73a9f649f3613cbe Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 1 Aug 2007 02:54:14 +0300 Subject: [PATCH] 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. --- config/dbus-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/dbus-core.c b/config/dbus-core.c index 008e21a98..28881596f 100644 --- a/config/dbus-core.c +++ b/config/dbus-core.c @@ -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; + } } }