From 8a903a3696cc93c7828bea9f098896ca9c410418 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 17 Dec 2008 16:01:42 +0100 Subject: [PATCH] Handle failure of device registration --- plugins/bluetooth.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index 8c83a98..6b0f05c 100644 --- a/plugins/bluetooth.c +++ b/plugins/bluetooth.c @@ -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, -- 1.7.9.5