#define NUMBER_OF_FLAGS 10
GDBusConnection *g_conn;
-GDBusNodeInfo *obj_info;
guint owner_id;
guint manager_id;
static gboolean new_service = FALSE;
const gchar *introspection_data)
{
GError *err = NULL;
+ GDBusNodeInfo *node_info = NULL;
if (introspection_data == NULL)
return NULL;
- if (obj_info == NULL) {
- BT_DBG("Create new node info");
- obj_info = g_dbus_node_info_new_for_xml(introspection_data, &err);
- if (err) {
- BT_ERR("Unable to create node: %s", err->message);
- g_clear_error(&err);
- return NULL;
- }
+ BT_DBG("Create new node info");
+ node_info = g_dbus_node_info_new_for_xml(introspection_data, &err);
+
+ if (err) {
+ BT_ERR("Unable to create node: %s", err->message);
+ g_clear_error(&err);
+ return NULL;
}
- return obj_info;
+ return node_info;
}
static struct gatt_service_info *__bt_gatt_find_gatt_service_info(
return BLUETOOTH_ERROR_NONE;
failed:
- if (obj_info)
- g_dbus_node_info_unref(obj_info);
-
if (owner_id)
g_bus_unown_name(owner_id);
g_free(app_path);
- obj_info = NULL;
app_path = NULL;
owner_id = 0;
g_object_unref(manager_gproxy);
manager_gproxy = NULL;
- /* Temperary block under codes to avoid TC blocking issue.
- But we should unref node info in later. */
-#if 0
- g_dbus_node_info_unref(obj_info);
- obj_info = NULL;
-#endif
__bt_gatt_close_gdbus_connection();
return ret;
char_info = __bt_gatt_find_gatt_char_info(serv_path, char_path);
if (char_info == NULL) {
g_strfreev(line_argv);
+ g_free(serv_path);
return BLUETOOTH_ERROR_INVALID_PARAM;
}
if (node_info == NULL) {
g_strfreev(line_argv);
+ g_free(serv_path);
return BLUETOOTH_ERROR_INTERNAL;
}
g_error_free(error);
g_free(path);
g_strfreev(line_argv);
+ g_free(serv_path);
return BLUETOOTH_ERROR_INTERNAL;
}
*desc_path = g_strdup(path);
g_free(path);
+ g_free(serv_path);
g_strfreev(line_argv);
g_variant_builder_unref(inner_builder);
g_variant_builder_unref(builder);
if (!__bt_gatt_get_service_state(serv_path)) {
BT_DBG("service not registered for this characteristic \n");
+ g_free(serv_path);
g_strfreev(line_argv);
return BLUETOOTH_ERROR_INTERNAL;
}
char_info = __bt_gatt_find_gatt_char_info(serv_path, char_path);
if (char_info == NULL) {
+ g_free(serv_path);
+ g_strfreev(line_argv);
+ g_variant_builder_unref(inner_builder);
+ g_variant_builder_unref(outer_builder);
+ g_variant_builder_unref(invalidated_builder);
+
return BLUETOOTH_ERROR_INVALID_DATA;
}
}
}
+ g_free(serv_path);
g_strfreev(line_argv);
g_variant_builder_unref(inner_builder);
g_variant_builder_unref(outer_builder);
if (req_info) {
if (resp_state != BLUETOOTH_ERROR_NONE) {
-
- GQuark quark = g_quark_from_string("gatt-server");
- GError *err = g_error_new(quark, 0, "Application Error");
- g_dbus_method_invocation_return_gerror(req_info->context, err);
- g_error_free(err);
+ g_dbus_method_invocation_return_dbus_error(req_info->context,
+ "org.bluez.Error.Failed", "Application Error");
gatt_requests = g_slist_remove(gatt_requests, req_info);
if (!__bt_gatt_get_service_state(serv_path)) {
BT_DBG("service not registered for this characteristic \n");
+ g_free(serv_path);
g_strfreev(line_argv);
return BLUETOOTH_ERROR_INTERNAL;
}
+ g_free(serv_path);
+
outer_builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
invalidated_builder = g_variant_builder_new(G_VARIANT_TYPE("as"));