Handle failure of device registration
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 17 Dec 2008 15:01:42 +0000 (16:01 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 17 Dec 2008 15:01:42 +0000 (16:01 +0100)
plugins/bluetooth.c

index 8c83a98..6b0f05c 100644 (file)
@@ -243,7 +243,11 @@ static void add_adapter(DBusConnection *connection, const char *path)
 
        device->name = g_path_get_basename(path);
 
-       connman_element_register(device, NULL);
+       if (connman_element_register(device, NULL) < 0) {
+               connman_element_unref(device);
+               return;
+       }
+
        device_list = g_slist_append(device_list, device);
 
        message = dbus_message_new_method_call(BLUEZ_SERVICE, path,