summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'dbus/dbus-bus.c')
-rw-r--r--dbus/dbus-bus.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c
index 74703866..e7b4c06e 100644
--- a/dbus/dbus-bus.c
+++ b/dbus/dbus-bus.c
@@ -428,8 +428,11 @@ dbus_bus_register (DBusConnection *connection,
DBusMessage *message, *reply;
char *name;
BusData *bd;
-
+ dbus_bool_t retval;
+
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ retval = FALSE;
bd = ensure_bus_data (connection);
if (bd == NULL)
@@ -461,22 +464,26 @@ dbus_bus_register (DBusConnection *connection,
dbus_message_unref (message);
if (reply == NULL)
- {
- _DBUS_ASSERT_ERROR_IS_SET (error);
- return FALSE;
- }
+ goto out;
+ else if (dbus_set_error_from_message (error, reply))
+ goto out;
+ else if (!dbus_message_get_args (reply, error,
+ DBUS_TYPE_STRING, &name,
+ 0))
+ goto out;
+
+ bd->base_service = name;
- if (!dbus_message_get_args (reply, error,
- DBUS_TYPE_STRING, &name,
- 0))
- {
- _DBUS_ASSERT_ERROR_IS_SET (error);
- return FALSE;
- }
+ retval = TRUE;
+
+ out:
+ if (reply)
+ dbus_message_unref (reply);
- bd->base_service = name;
+ if (!retval)
+ _DBUS_ASSERT_ERROR_IS_SET (error);
- return TRUE;
+ return retval;
}