agent: Always clean up and unref on agent shutdown
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 3 Sep 2012 11:17:15 +0000 (14:17 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 4 Sep 2012 09:09:23 +0000 (12:09 +0300)
src/agent.c

index aff41df..db5ea13 100644 (file)
@@ -957,19 +957,16 @@ void __connman_agent_cleanup(void)
        if (agent_watch > 0)
                g_dbus_remove_watch(connection, agent_watch);
 
-       if (agent_path == NULL)
-               return;
-
-       message = dbus_message_new_method_call(agent_sender, agent_path,
-                                       CONNMAN_AGENT_INTERFACE, "Release");
-       if (message == NULL)
-               return;
-
-       dbus_message_set_no_reply(message, TRUE);
-
-       g_dbus_send_message(connection, message);
+       if (agent_path != NULL) {
+               message = dbus_message_new_method_call(agent_sender, agent_path,
+                               CONNMAN_AGENT_INTERFACE, "Release");
+               if (message != NULL) {
+                       dbus_message_set_no_reply(message, TRUE);
+                       g_dbus_send_message(connection, message);
+               }
 
-       agent_free();
+               agent_free();
+       }
 
        dbus_connection_unref(connection);
 }