manager: Manage properly the pending message for session mode
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Wed, 26 Sep 2012 10:55:39 +0000 (13:55 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 26 Sep 2012 12:20:29 +0000 (15:20 +0300)
src/manager.c

index 1bf9189..205359a 100644 (file)
@@ -116,7 +116,7 @@ static DBusMessage *set_property(DBusConnection *conn,
                __connman_session_set_mode(sessionmode);
 
                if (sessionmode == TRUE && connman_state_idle == FALSE) {
-                       session_mode_pending = msg;
+                       session_mode_pending = dbus_message_ref(msg);
                        return NULL;
                }
 
@@ -487,6 +487,9 @@ void __connman_manager_cleanup(void)
        if (connection == NULL)
                return;
 
+       if (session_mode_pending != NULL)
+               dbus_message_unref(session_mode_pending);
+
        connman_notifier_unregister(&technology_notifier);
 
        g_dbus_unregister_interface(connection, CONNMAN_MANAGER_PATH,