session: Fix error case handling
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Wed, 5 Dec 2012 13:57:46 +0000 (14:57 +0100)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 5 Dec 2012 14:50:37 +0000 (16:50 +0200)
There is no need to unref the pending message, because in all
cases we generate a reply message which takes care of unrefing
the message. Hence the dbus_message_unref() is not needed.

Furthermore, we need to pass the created error message to the bus
via g_dbus_send_message() so that the client gets always a response.

src/session.c

index 3273c67..7ffeedc 100644 (file)
@@ -1689,11 +1689,12 @@ static void session_create_cb(struct connman_session *session,
 
 out:
        if (err < 0) {
-               __connman_error_failed(user_config->pending, -err);
+               reply = __connman_error_failed(user_config->pending, -err);
+               g_dbus_send_message(connection, reply);
+
                free_session(session);
        }
 
-       dbus_message_unref(user_config->pending);
        g_free(user_config);
 }