From cc8adca6972825c5efe819fe96d63460995957f6 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Mon, 17 Dec 2012 12:03:59 +0100 Subject: [PATCH] agent: Don't crash when no agent was registered on exit If the user never registered an agent, agent_sender and agent_path are NULL. D-Bus does not handle this gracefully, instead it kills ConnMan. So let's skip the D-Bus part in this case. connmand[4271]: src/agent.c:connman_agent_driver_unregister() Sending release to (null) path (null) iface net.connman.Agent process 4271: arguments to dbus_message_new_method_call() were incorrect, assertion "path != NULL" failed in file dbus-message.c line 1198. This is normally a bug in some application using the D-Bus library. D-Bus not built with -rdynamic so unable to print a backtrace connmand[4271]: Aborting (signal 6) [./src/connmand] connmand[4271]: ++++++++ backtrace ++++++++ connmand[4271]: #0 0x3a9920f500 in /lib64/libpthread.so.0 connmand[4271]: #1 0x3a98e36285 in /lib64/libc.so.6 connmand[4271]: #2 0x3a98e37b9b in /lib64/libc.so.6 connmand[4271]: #3 0x3c7602fff5 in /lib64/libdbus-1.so.3 connmand[4271]: #4 0x3c76026fc1 in /lib64/libdbus-1.so.3 connmand[4271]: #5 0x3c76018aea in /lib64/libdbus-1.so.3 connmand[4271]: #6 0x45b8b1 in connman_agent_driver_unregister() at src/agent.c:426 connmand[4271]: #7 0x457b7c in __connman_service_cleanup() at src/service.c:6756 connmand[4271]: #8 0x43f54f in main() at src/main.c:702 connmand[4271]: #9 0x3a98e2169d in /lib64/libc.so.6 connmand[4271]: +++++++++++++++++++++++++++ --- src/agent.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/agent.c b/src/agent.c index c08dba8..3be4b61 100644 --- a/src/agent.c +++ b/src/agent.c @@ -414,6 +414,9 @@ void connman_agent_driver_unregister(struct connman_agent_driver *driver) DBG("Unregistering driver %p name %s", driver, driver->name); + if (agent_sender == NULL && agent_path == NULL) + goto out; + for (list = driver_list; list; list = list->next) { DBusMessage *message; @@ -440,6 +443,7 @@ void connman_agent_driver_unregister(struct connman_agent_driver *driver) break; } +out: driver_list = g_slist_remove(driver_list, driver); } -- 2.7.4