if (manager->max_ads == 0)
return;
- if (!g_dbus_register_interface(btd_get_dbus_connection(),
- adapter_get_path(manager->adapter),
- LE_ADVERTISING_MGR_IFACE, methods,
- NULL, properties, manager, NULL)) {
- error("Failed to register " LE_ADVERTISING_MGR_IFACE);
- return;
- }
-
/* Reset existing instances */
if (feat->num_instances)
remove_advertising(manager, 0);
}
manager->mgmt_index = btd_adapter_get_index(adapter);
+ manager->clients = queue_new();
+ manager->supported_flags = MGMT_ADV_FLAG_LOCAL_NAME;
+
+ if (!g_dbus_register_interface(btd_get_dbus_connection(),
+ adapter_get_path(manager->adapter),
+ LE_ADVERTISING_MGR_IFACE, methods,
+ NULL, properties, manager, NULL)) {
+ error("Failed to register " LE_ADVERTISING_MGR_IFACE);
+ goto fail;
+ }
if (!mgmt_send(manager->mgmt, MGMT_OP_READ_ADV_FEATURES,
manager->mgmt_index, 0, NULL,
read_adv_features_callback, manager, NULL)) {
error("Failed to read advertising features");
- manager_destroy(manager);
- return NULL;
+ goto fail;
}
- manager->clients = queue_new();
- manager->supported_flags = MGMT_ADV_FLAG_LOCAL_NAME;
-
return manager;
+
+fail:
+ manager_destroy(manager);
+ return NULL;
}
struct btd_adv_manager *btd_adv_manager_new(struct btd_adapter *adapter)