NULL, /* GDBusAuthObserver */
NULL,
&err);
+ g_free(address);
if (!g_conn) {
if (err) {
BT_ERR("Unable to connect to dbus: %s", err->message);
NULL, /* GDBusAuthObserver */
NULL,
&err);
-
+ g_free(address);
if (!local_system_gconn) {
BT_ERR("Unable to connect to dbus: %s", err->message);
g_clear_error(&err);
/* Register ObjectManager interface */
node_info = __bt_gatt_create_method_node_info(
manager_introspection_xml);
-
if (node_info == NULL) {
BT_ERR("failed to get node info");
goto failed;
&manager_interface_vtable,
NULL, NULL, &error);
}
-
+ g_dbus_node_info_unref(node_info);
if (manager_id == 0) {
BT_ERR("failed to register: %s", error->message);
g_error_free(error);
node_info = __bt_gatt_create_method_node_info(
service_introspection_xml);
-
if (node_info == NULL)
return BLUETOOTH_ERROR_INTERNAL;
node_info->interfaces[0],
&serv_interface_vtable,
NULL, NULL, &error);
+ g_dbus_node_info_unref(node_info);
if (object_id == 0) {
BT_ERR("failed to register: %s", error->message);
node_info = __bt_gatt_create_method_node_info(
characteristics_introspection_xml);
-
if (node_info == NULL)
return BLUETOOTH_ERROR_INTERNAL;
node_info->interfaces[0],
&char_interface_vtable,
NULL, NULL, &error);
+ g_dbus_node_info_unref(node_info);
if (object_id == 0) {
BT_ERR("failed to register: %s", error->message);
node_info = __bt_gatt_create_method_node_info(
descriptor_introspection_xml);
-
if (node_info == NULL) {
g_strfreev(line_argv);
g_free(serv_path);
node_info->interfaces[0],
&desc_interface_vtable,
NULL, NULL, &error);
+ g_dbus_node_info_unref(node_info);
if (object_id == 0) {
BT_ERR("failed to register: %s", error->message);
g_strfreev(line_argv);
g_variant_builder_unref(inner_builder);
g_variant_builder_unref(builder);
+ g_variant_builder_unref(builder2);
return BLUETOOTH_ERROR_NONE;
}
int i = 0;
gchar **line_argv = NULL;
gchar *serv_path = NULL;
+ const char *value = NULL;
line_argv = g_strsplit_set(char_path, "/", 0);
serv_path = g_strdup_printf("/%s/%s/%s", line_argv[1], line_argv[2], line_argv[3]);
char_info->value_length = value_length;
- char_info->char_value = (char *)realloc(char_info->char_value, value_length);
+ value = (char *)realloc(char_info->char_value, value_length);
+ if (value == 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_MEMORY_ALLOCATION;
+ }
+
+ char_info->char_value = (char*)value;
if (char_info->char_value) {
for (i = 0; i < value_length; i++)
char_info->char_value[i] = char_value[i];
if (resp_state != BLUETOOTH_ATT_ERROR_NONE) {
BT_ERR("resp_state is 0x%X", resp_state);
-
- switch (resp_state) {
- case BLUETOOTH_ATT_ERROR_WRITE_REQUEST_REJECTED:
- g_dbus_method_invocation_return_dbus_error(req_info->context,
- "org.bluez.Error.Failed", "Write Request Rejected");
- break;
- case BLUETOOTH_ATT_ERROR_OBJECT_NOT_SELECTED:
- g_dbus_method_invocation_return_dbus_error(req_info->context,
- "org.bluez.Error.Failed", "Object Not Selected");
- break;
- case BLUETOOTH_ATT_ERROR_CONCURRENCY_LIMIT_EXCEEDED:
- g_dbus_method_invocation_return_dbus_error(req_info->context,
- "org.bluez.Error.Failed", "Concurrency Limit Exceeded");
- break;
- case BLUETOOTH_ATT_ERROR_OBJECT_NAME_EXISTS:
- g_dbus_method_invocation_return_dbus_error(req_info->context,
- "org.bluez.Error.Failed", "Object Name Already Exists");
- break;
- case BLUETOOTH_ATT_ERROR_CCCD_IMPROPERLY_CONFIGURED:
- g_dbus_method_invocation_return_dbus_error(req_info->context,
- "org.bluez.Error.Failed", "CCC Improperly Configured");
- break;
- default:
- g_dbus_method_invocation_return_dbus_error(req_info->context,
- "org.bluez.Error.Failed", "Application Error");
- break;
- }
+ char err_msg[20] = { 0, };
+ g_snprintf(err_msg, sizeof(err_msg), "ATT error: 0x%02x", resp_state);
+ g_dbus_method_invocation_return_dbus_error(req_info->context,
+ "org.bluez.Error.Failed", err_msg);
gatt_requests = g_slist_remove(gatt_requests, req_info);