+
+void __connman_agent_cleanup(void)
+{
+ DBusMessage *msg;
+
+ DBG("conn %p", connection);
+
+ if (agent_watch > 0)
+ g_dbus_remove_watch(connection, agent_watch);
+
+ if (agent_path == NULL)
+ return;
+
+ msg = dbus_message_new_method_call(agent_sender, agent_path,
+ CONNMAN_AGENT_INTERFACE, "Release");
+ if (msg == NULL)
+ return;
+
+ dbus_message_set_no_reply(msg, TRUE);
+
+ dbus_connection_send(connection, msg, NULL);
+
+ dbus_message_unref(msg);
+
+ agent_free();
+
+ dbus_connection_unref(connection);
+}