info = &g_array_index(out_param2,
bluetooth_device_info_t, i);
- dev_info = g_memdup(info, sizeof(bluetooth_device_info_t));
+ dev_info = g_memdup2(info, sizeof(bluetooth_device_info_t));
if (dev_info)
g_ptr_array_add(*dev_list, (gpointer)dev_info);
ptr = &g_array_index(out_param,
bluetooth_device_address_t, i);
- addr = g_memdup(ptr, sizeof(bluetooth_device_address_t));
+ addr = g_memdup2(ptr, sizeof(bluetooth_device_address_t));
if (addr)
g_ptr_array_add(*addr_list, (gpointer)addr);
info = g_malloc0(sizeof(bluetooth_tds_transport_data_info_t));
info->data_length = data_len;
- info->data = g_memdup(data, data_len);
+ info->data = g_memdup2(data, data_len);
_bt_convert_addr_string_to_type(info->device_address.addr,
address);
info = g_malloc0(sizeof(bluetooth_otp_resp_info_t));
info->data_length = data_len;
- info->data = g_memdup(data, data_len);
+ info->data = g_memdup2(data, data_len);
info->handle = g_strdup(handle);
_bt_common_event_cb(BLUETOOTH_EVENT_OTP_READ_CHAR_VAL,
ind_res = g_malloc0(sizeof(bluetooth_otp_resp_info_t));
ind_res->data_length = g_variant_get_size(byte_var);
buffer = (char *)g_variant_get_data(byte_var);
- ind_res->data = g_memdup(buffer, ind_res->data_length);
+ ind_res->data = g_memdup2(buffer, ind_res->data_length);
ind_res->handle = g_strdup(handle);
_bt_common_event_cb(BLUETOOTH_EVENT_OTP_INDICATION,
info->channel_id = conn_info->channel_id;
info->app_handle = list->app_handle;
info->fd = fd;
- address = g_memdup(&(conn_info->device_address), sizeof(bluetooth_device_address_t));
+ address = g_memdup2(&(conn_info->device_address), sizeof(bluetooth_device_address_t));
gio = g_io_channel_unix_new(fd);
g_io_channel_set_close_on_unref(gio, TRUE);
info = &g_array_index(out_param,
bluetooth_mesh_node_info_t, i);
- data = g_memdup(info, sizeof(bluetooth_mesh_node_info_t));
+ data = g_memdup2(info, sizeof(bluetooth_mesh_node_info_t));
g_ptr_array_add(*nodes, (gpointer)data);
}
}
model_obj = g_array_index(out_param,
guint32, i);
- model_ptr = g_memdup(&model_obj, sizeof(guint32));
+ model_ptr = g_memdup2(&model_obj, sizeof(guint32));
g_ptr_array_add(*models, (gpointer)model_ptr);
}
}
BT_INFO("Mesh: Group net UUID[%s]", info->net_uuid);
if (info->is_virtual)
BT_INFO("Mesh: Virual Label UUID [%s]", info->label_uuid);
- grp_info = g_memdup(info,
+ grp_info = g_memdup2(info,
sizeof(bluetooth_mesh_network_group_info_t));
g_ptr_array_add(*groups, (gpointer)grp_info);
}
netkey_index = g_array_index(out_param,
guint16, i);
- netkey_idx = g_memdup(&netkey_index, sizeof(guint16));
+ netkey_idx = g_memdup2(&netkey_index, sizeof(guint16));
g_ptr_array_add(*netkeys, (gpointer)netkey_idx);
}
}
appkey_index = g_array_index(out_param,
guint16, i);
- appkey_idx = g_memdup(&appkey_index, sizeof(guint16));
+ appkey_idx = g_memdup2(&appkey_index, sizeof(guint16));
g_ptr_array_add(*appkeys, (gpointer)appkey_idx);
}
}
netkey_index = g_array_index(out_param,
guint16, i);
- netkey_idx = g_memdup(&netkey_index, sizeof(guint16));
+ netkey_idx = g_memdup2(&netkey_index, sizeof(guint16));
g_ptr_array_add(*netkeys, (gpointer)netkey_idx);
}
}
appkey_index = g_array_index(out_param,
guint16, i);
- appkey_idx = g_memdup(&appkey_index, sizeof(guint16));
+ appkey_idx = g_memdup2(&appkey_index, sizeof(guint16));
g_ptr_array_add(*appkeys, (gpointer)appkey_idx);
}
}
memcpy(&char_info->char_value[offset], value, value_length);
} else {
/* Values crossing pervious allocated limit realloc */
- data = g_memdup(char_info->char_value, char_info->value_length);
+ data = g_memdup2(char_info->char_value, char_info->value_length);
char_info->char_value = g_try_realloc(char_info->char_value, offset + value_length);
memcpy(char_info->char_value, data, char_info->value_length);
memcpy(&char_info->char_value[offset], value, value_length);
} else {
info.event_code = event_code;
buffer = (unsigned char*)g_variant_get_data(value);
- info.data = g_memdup(buffer, length);
+ info.data = g_memdup2(buffer, length);
info.data_len = length;
if (!event_cb)
ERR("event_cb is NULL");
l = g_slist_find_custom(mesh_apps, net_uuid->uu, __mesh_compare_network_uuid);
if (l) {
app = l->data;
- dev = g_memdup((gpointer)dev_uuid, 16);
+ dev = g_memdup2((gpointer)dev_uuid, 16);
INFO("Mesh: Schedule Add Node request to meshd");
if (!l_dbus_proxy_method_call(app->mgmt_proxy, "AddNode",
__bt_hal_mesh_add_node_setup,
prop.type = properties[i].type;
prop.len = properties[i].len;
- prop.val = g_memdup(properties[i].val, prop.len);
+ prop.val = g_memdup2(properties[i].val, prop.len);
BT_DBG("prop: %s", convert_bt_property_2_str(&prop));
if (num_properties == 1) {
/* Application has requested this property SET/GET hence send EVENT */
send_event(OAL_EVENT_ADAPTER_PROPERTY_ADDRESS,
- g_memdup(&local_address, sizeof(local_address)),
+ g_memdup2(&local_address, sizeof(local_address)),
sizeof(local_address));
}
break;
discoverable_timeout = timeout;
send_event(OAL_EVENT_ADAPTER_MODE_DISCOVERABLE_TIMEOUT,
- g_memdup(properties[i].val, sizeof(uint32_t)),
+ g_memdup2(properties[i].val, sizeof(uint32_t)),
sizeof(uint32_t));
break;
}
BT_INFO("A2DP role: %u", a2dp_role);
send_event(OAL_EVENT_ADAPTER_PROPERTY_A2DP_ROLE,
- g_memdup(properties[i].val, sizeof(uint32_t)),
+ g_memdup2(properties[i].val, sizeof(uint32_t)),
sizeof(uint32_t));
break;
}
return BLUETOOTH_ERROR_NONE;
}
- *data = g_memdup(&in_data[i], len);
+ *data = g_memdup2(&in_data[i], len);
if (*data == NULL)
return BLUETOOTH_ERROR_OUT_OF_MEMORY;
*data_len = len;
if (result == BLUETOOTH_ERROR_NONE) {
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
- function_name, g_memdup(&type, sizeof(int)));
+ function_name, g_memdup2(&type, sizeof(int)));
}
break;
}
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
- (gpointer)g_memdup(¶m, sizeof(bluetooth_gatt_client_svc_prop_info_t)));
+ (gpointer)g_memdup2(¶m, sizeof(bluetooth_gatt_client_svc_prop_info_t)));
}
break;
}
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
- (gpointer)g_memdup(¶m, sizeof(bluetooth_gatt_client_char_prop_info_t)));
+ (gpointer)g_memdup2(¶m, sizeof(bluetooth_gatt_client_char_prop_info_t)));
}
break;
}
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
- (gpointer)g_memdup(¶m, sizeof(bluetooth_gatt_client_char_prop_info_t)));
+ (gpointer)g_memdup2(¶m, sizeof(bluetooth_gatt_client_char_prop_info_t)));
}
break;
}
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
- (gpointer)g_memdup(¶m, sizeof(bluetooth_gatt_client_desc_prop_info_t)));
+ (gpointer)g_memdup2(¶m, sizeof(bluetooth_gatt_client_desc_prop_info_t)));
}
break;
}
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
- (gpointer)g_memdup(¶m, sizeof(bluetooth_gatt_client_char_prop_info_t)));
+ (gpointer)g_memdup2(¶m, sizeof(bluetooth_gatt_client_char_prop_info_t)));
}
break;
}
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
- (gpointer)g_memdup(¶m, sizeof(bluetooth_gatt_client_desc_prop_info_t)));
+ (gpointer)g_memdup2(¶m, sizeof(bluetooth_gatt_client_desc_prop_info_t)));
}
break;
}
if (BLUETOOTH_ERROR_NONE == result) {
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender, function_name,
- (gpointer)g_memdup(¶m, sizeof(bluetooth_gatt_client_char_prop_info_t)));
+ (gpointer)g_memdup2(¶m, sizeof(bluetooth_gatt_client_char_prop_info_t)));
}
}
break;
info = &g_array_index(param3,
bluetooth_mesh_model_t, i);
- mod = g_memdup(info, sizeof(bluetooth_mesh_model_t));
+ mod = g_memdup2(info, sizeof(bluetooth_mesh_model_t));
if (mod)
model_list = g_slist_append(model_list,
} else {
BT_INFO("Mesh: Destroy Network scheduled: add invocation");
bluetooth_mesh_network_t *net = \
- g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+ g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
bluetooth_mesh_model_t *mod = NULL;
info = &g_array_index(param2,
bluetooth_mesh_model_t, i);
- mod = g_memdup(info, sizeof(bluetooth_mesh_model_t));
+ mod = g_memdup2(info, sizeof(bluetooth_mesh_model_t));
if (mod)
model_list = g_slist_append(model_list,
&network, sizeof(bluetooth_mesh_network_t));
} else {
bluetooth_mesh_network_t *net = \
- g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+ g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
sizeof(bluetooth_mesh_provisioning_request_t));
} else {
bluetooth_mesh_provisioning_request_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_provisioning_request_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_provisioning_request_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
if (result != BLUETOOTH_ERROR_NONE) {
g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
} else {
- bluetooth_mesh_network_t *net = g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+ bluetooth_mesh_network_t *net = g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
if (result != BLUETOOTH_ERROR_NONE) {
g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
} else {
- bluetooth_mesh_network_t *net = g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+ bluetooth_mesh_network_t *net = g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
if (result != BLUETOOTH_ERROR_NONE) {
g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
} else {
- bluetooth_mesh_network_t *net = g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+ bluetooth_mesh_network_t *net = g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
if (result != BLUETOOTH_ERROR_NONE) {
g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
} else {
- bluetooth_mesh_network_t *net = g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+ bluetooth_mesh_network_t *net = g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
if (result != BLUETOOTH_ERROR_NONE) {
g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
} else {
- bluetooth_mesh_network_t *net = g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+ bluetooth_mesh_network_t *net = g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
if (result != BLUETOOTH_ERROR_NONE) {
g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
} else {
- bluetooth_mesh_network_t *net = g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+ bluetooth_mesh_network_t *net = g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
sizeof(bluetooth_mesh_node_discover_t));
} else {
bluetooth_mesh_node_discover_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_node_discover_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_node_discover_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
&req, sizeof(bluetooth_mesh_node_features_t));
} else {
bluetooth_mesh_node_features_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_node_features_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_node_features_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
&req, sizeof(bluetooth_mesh_key_configure_t));
} else {
bluetooth_mesh_key_configure_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_key_configure_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_key_configure_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_node_ttl_info_t));
} else {
bluetooth_mesh_node_ttl_info_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_node_ttl_info_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_node_ttl_info_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
} else {
bluetooth_mesh_model_configure_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_msg_t));
} else {
bluetooth_mesh_model_msg_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_model_msg_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_model_msg_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
} else {
bluetooth_mesh_model_configure_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
} else {
bluetooth_mesh_model_configure_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
&req, sizeof(bluetooth_mesh_model_configure_t));
} else {
bluetooth_mesh_model_configure_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
} else {
bluetooth_mesh_model_configure_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
if (result != BLUETOOTH_ERROR_NONE) {
g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
} else {
- bluetooth_mesh_model_configure_t *param = g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+ bluetooth_mesh_model_configure_t *param = g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
&req, sizeof(bluetooth_mesh_model_configure_t));
} else {
bluetooth_mesh_model_configure_t *param = \
- g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+ g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
return BLUETOOTH_ERROR_NONE;
}
- *data = g_memdup(&in_data[i], len);
+ *data = g_memdup2(&in_data[i], len);
if (*data == NULL)
return BLUETOOTH_ERROR_OUT_OF_MEMORY;
*data_len = len;
g_free(dest->manufacturer_data);
dest->manufacturer_data_len = src->manufacturer_data_len;
- dest->manufacturer_data = g_memdup(
+ dest->manufacturer_data = g_memdup2(
src->manufacturer_data, src->manufacturer_data_len);
}
oal_event->type = event_type;
if (event_data)
- oal_event->data = g_memdup(event_data, len);
+ oal_event->data = g_memdup2(event_data, len);
g_idle_add(__bt_handle_oal_events, oal_event);
}
for (indx = 0; indx < count; indx++) {
bluetooth_device_address_t *dev_addr;
- dev_addr = g_memdup(&(addr_list[indx]), sizeof(bluetooth_device_address_t));
+ dev_addr = g_memdup2(&(addr_list[indx]), sizeof(bluetooth_device_address_t));
bonded_addr_list = g_slist_append(bonded_addr_list, dev_addr);
}
return BLUETOOTH_ERROR_NOT_PAIRED;
}
- g_idle_add(__reply_pending_request, g_memdup(&request, sizeof(int)));
+ g_idle_add(__reply_pending_request, g_memdup2(&request, sizeof(int)));
BT_DBG("-");
return BLUETOOTH_ERROR_NONE;
}
return BLUETOOTH_ERROR_NONE;
}
- g_idle_add(__reply_pending_request, g_memdup(&request, sizeof(int)));
+ g_idle_add(__reply_pending_request, g_memdup2(&request, sizeof(int)));
BT_DBG("-");
return BLUETOOTH_ERROR_NONE;
}
return BLUETOOTH_ERROR_NOT_PAIRED;
}
- g_idle_add(__reply_pending_request, g_memdup(&request, sizeof(int)));
+ g_idle_add(__reply_pending_request, g_memdup2(&request, sizeof(int)));
BT_DBG("-");
return BLUETOOTH_ERROR_NONE;
}
return BLUETOOTH_ERROR_NONE;
}
- g_idle_add(__reply_pending_request, g_memdup(&request, sizeof(int)));
+ g_idle_add(__reply_pending_request, g_memdup2(&request, sizeof(int)));
BT_DBG("-");
return BLUETOOTH_ERROR_NONE;
}
rem_info->manufacturer_data_len = oal_dev_props->adv_len;
rem_info->manufacturer_data =
- g_memdup(oal_dev_props->adv_data,
+ g_memdup2(oal_dev_props->adv_data,
oal_dev_props->adv_len);
BT_DBG("----Advertising Data Length: %d",
rem_info->manufacturer_data_len);
dev_info->manufacturer_data_len = oal_ble_dev->adv_len;
if (dev_info->manufacturer_data_len)
- dev_info->manufacturer_data = g_memdup(oal_ble_dev->adv_data,
+ dev_info->manufacturer_data = g_memdup2(oal_ble_dev->adv_data,
dev_info->manufacturer_data_len);
else
dev_info->manufacturer_data = NULL;
trigger_bond_info->addr = g_strdup(address);
trigger_bond_info->conn_type = conn_type;
trigger_bond_info->is_device_creating = TRUE;
- trigger_bond_info->dev_addr = g_memdup(device_address, sizeof(bluetooth_device_address_t));
+ trigger_bond_info->dev_addr = g_memdup2(device_address, sizeof(bluetooth_device_address_t));
trigger_bond_info->dev_info = NULL;
/* Ready to initiate bonding */
trigger_unbond_info = g_malloc0(sizeof(bt_bond_data_t));
trigger_unbond_info->addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
trigger_unbond_info->addr = g_strdup(address);
- trigger_unbond_info->dev_addr = g_memdup(device_address, sizeof(bluetooth_device_address_t));
+ trigger_unbond_info->dev_addr = g_memdup2(device_address, sizeof(bluetooth_device_address_t));
/* Check if Bonding is already going on, we should not abruptly remove bonding*/
if (trigger_bond_info && strncmp(trigger_bond_info->addr, trigger_unbond_info->addr, BT_ADDRESS_STRING_SIZE) == 0) {
/* allocate user data so that it can be retrieved in callback */
service_search_info = g_malloc0(sizeof(bt_service_search_info_data_t));
service_search_info->addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
- service_search_info->dev_addr = g_memdup(device_address, sizeof(bluetooth_device_address_t));
+ service_search_info->dev_addr = g_memdup2(device_address, sizeof(bluetooth_device_address_t));
_bt_convert_addr_type_to_string(service_search_info->addr,
device_address->addr);
prep_data->device_address = addr;
prep_data->offset = event->attr_trans.offset;
prep_data->length = event->length;
- prep_data->value = g_memdup(&event->value[0], event->length);
+ prep_data->value = g_memdup2(&event->value[0], event->length);
return prep_data;
}
is_prepare_write = event->is_prep;
if (event->length > 0)
- write_val = g_memdup(&event->value[0], event->length);
+ write_val = g_memdup2(&event->value[0], event->length);
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
_bt_convert_addr_type_to_string(address,
// BT_INFO("Data[%d] = [0x%x]", i, event_data->data[i]);
/* Read data */
- read_val = g_memdup(&event_data->data[0], event_data->data_len);
+ read_val = g_memdup2(&event_data->data[0], event_data->data_len);
data = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
}
/* SVC uuid */
- svc_uuid = g_memdup(&event_data->uuid_status.srvc_id.id.uuid.uuid[0], uuid_len);
+ svc_uuid = g_memdup2(&event_data->uuid_status.srvc_id.id.uuid.uuid[0], uuid_len);
data_svc_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
TRUE, NULL, NULL);
/* Char uuid */
- char_uuid = g_memdup(&event_data->uuid_status.char_id.uuid.uuid[0], uuid_len);
+ char_uuid = g_memdup2(&event_data->uuid_status.char_id.uuid.uuid[0], uuid_len);
data_char_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
BT_DBG("Data[%d] = [0x%x]", i, event_data->data[i]);
/* Read data */
- read_val = g_memdup(&event_data->data[0], event_data->data_len);
+ read_val = g_memdup2(&event_data->data[0], event_data->data_len);
data = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
FALSE, NULL, NULL);
}
/* SVC uuid */
- svc_uuid = g_memdup(&event_data->uuid_status.srvc_id.id.uuid.uuid[0], uuid_len);
+ svc_uuid = g_memdup2(&event_data->uuid_status.srvc_id.id.uuid.uuid[0], uuid_len);
data_svc_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
TRUE, NULL, NULL);
/* Char uuid */
- char_uuid = g_memdup(&event_data->uuid_status.char_id.uuid.uuid[0], uuid_len);
+ char_uuid = g_memdup2(&event_data->uuid_status.char_id.uuid.uuid[0], uuid_len);
data_char_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
TRUE, NULL, NULL);
/* Desc uuid */
- desc_uuid = g_memdup(&event_data->uuid_status.descr_id.uuid.uuid[0], uuid_len);
+ desc_uuid = g_memdup2(&event_data->uuid_status.descr_id.uuid.uuid[0], uuid_len);
data_desc_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
/* Build event */
/* SVC uuid */
- svc_uuid = g_memdup(&event_data->srvc_id.id.uuid.uuid[0], uuid_len);
+ svc_uuid = g_memdup2(&event_data->srvc_id.id.uuid.uuid[0], uuid_len);
data_svc_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
TRUE, NULL, NULL);
/* Char uuid */
- char_uuid = g_memdup(&event_data->char_id.uuid.uuid[0], uuid_len);
+ char_uuid = g_memdup2(&event_data->char_id.uuid.uuid[0], uuid_len);
data_char_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
/* Build event */
/* SVC uuid */
- svc_uuid = g_memdup(&event_data->srvc_id.id.uuid.uuid[0], uuid_len);
+ svc_uuid = g_memdup2(&event_data->srvc_id.id.uuid.uuid[0], uuid_len);
data_svc_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
TRUE, NULL, NULL);
/* Char uuid */
- char_uuid = g_memdup(&event_data->char_id.uuid.uuid[0], uuid_len);
+ char_uuid = g_memdup2(&event_data->char_id.uuid.uuid[0], uuid_len);
data_char_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
TRUE, NULL, NULL);
/* Desc uuid */
- desc_uuid = g_memdup(&event_data->descr_id.uuid.uuid[0], uuid_len);
+ desc_uuid = g_memdup2(&event_data->descr_id.uuid.uuid[0], uuid_len);
data_desc_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
(unsigned char *)&(event_data->address.addr));
/* Read data */
- read_val = g_memdup(&event_data->data[0], event_data->data_len);
+ read_val = g_memdup2(&event_data->data[0], event_data->data_len);
data = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
event_data->data_len,
TRUE, NULL, NULL);
/* SVC uuid */
- svc_uuid = g_memdup(&event_data->srvc_id.id.uuid.uuid[0], uuid_len);
+ svc_uuid = g_memdup2(&event_data->srvc_id.id.uuid.uuid[0], uuid_len);
data_svc_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
TRUE, NULL, NULL);
/* Char uuid */
- char_uuid = g_memdup(&event_data->char_id.uuid.uuid[0], uuid_len);
+ char_uuid = g_memdup2(&event_data->char_id.uuid.uuid[0], uuid_len);
data_char_uuid = g_variant_new_from_data(
G_VARIANT_TYPE_BYTESTRING,
req->unicast);
/* Schedule event ot Application */
bluetooth_mesh_node_features_t *event = \
- g_memdup(req, sizeof(bluetooth_mesh_node_features_t));
+ g_memdup2(req, sizeof(bluetooth_mesh_node_features_t));
g_idle_add(__bt_mesh_vendor_feature_event_handler, (gpointer) event);
return BLUETOOTH_ERROR_NONE;
}
/* Queue the request with timeout */
__bt_mesh_add_request(opcode, req->primary_unicast,
net_uuid.uuid,
- g_memdup(req, sizeof(bluetooth_mesh_model_configure_t)));
+ g_memdup2(req, sizeof(bluetooth_mesh_model_configure_t)));
return BLUETOOTH_ERROR_NONE;
}
/* Queue the request with timeout */
__bt_mesh_add_request(opcode, req->primary_unicast,
net_uuid.uuid,
- g_memdup(req, sizeof(bluetooth_mesh_model_configure_t)));
+ g_memdup2(req, sizeof(bluetooth_mesh_model_configure_t)));
return BLUETOOTH_ERROR_NONE;
}
/* Queue the request with timeout */
__bt_mesh_add_request(MESH_OPCODE_CONFIG_MODEL_PUB_GET, req->primary_unicast, net_uuid.uuid,
- g_memdup(req, sizeof(bluetooth_mesh_model_configure_t)));
+ g_memdup2(req, sizeof(bluetooth_mesh_model_configure_t)));
return BLUETOOTH_ERROR_NONE;
}
/* Queue the request with timeout */
__bt_mesh_add_request(opcode, req->primary_unicast, net_uuid.uuid,
- g_memdup(req, sizeof(bluetooth_mesh_model_configure_t)));
+ g_memdup2(req, sizeof(bluetooth_mesh_model_configure_t)));
return BLUETOOTH_ERROR_NONE;
}
/* Queue the request with timeout */
__bt_mesh_add_request(opcode, req->primary_unicast, net_uuid.uuid,
- g_memdup(req, sizeof(bluetooth_mesh_model_configure_t)));
+ g_memdup2(req, sizeof(bluetooth_mesh_model_configure_t)));
return BLUETOOTH_ERROR_NONE;
}
/* Queue the request with timeout */
__bt_mesh_add_request(opcode, req->primary_unicast, net_uuid.uuid,
- g_memdup(req, sizeof(bluetooth_mesh_model_configure_t)));
+ g_memdup2(req, sizeof(bluetooth_mesh_model_configure_t)));
return BLUETOOTH_ERROR_NONE;
}
/* Queue the request with timeout */
__bt_mesh_add_request(opcode, req->primary_unicast, net_uuid.uuid,
- g_memdup(req, sizeof(bluetooth_mesh_model_configure_t)));
+ g_memdup2(req, sizeof(bluetooth_mesh_model_configure_t)));
return BLUETOOTH_ERROR_NONE;
}
/* Queue the request with timeout */
__bt_mesh_add_request(opcode, req->unicast, net_uuid.uuid,
- g_memdup(req, sizeof(bluetooth_mesh_node_ttl_info_t)));
+ g_memdup2(req, sizeof(bluetooth_mesh_node_ttl_info_t)));
return BLUETOOTH_ERROR_NONE;
}
/* Queue the request with timeout */
__bt_mesh_add_request(opcode, req->primary_unicast, net_uuid.uuid,
- g_memdup(req, sizeof(bluetooth_mesh_key_configure_t)));
+ g_memdup2(req, sizeof(bluetooth_mesh_key_configure_t)));
return BLUETOOTH_ERROR_NONE;
}
/* Queue the request with timeout */
__bt_mesh_add_request(opcode, req->primary_unicast, net_uuid.uuid,
- g_memdup(req, sizeof(bluetooth_mesh_model_msg_t)));
+ g_memdup2(req, sizeof(bluetooth_mesh_model_msg_t)));
return BLUETOOTH_ERROR_NONE;
}
}
if (accept == false)
- g_idle_add(__bt_send_rfcomm_server_fd, g_memdup(&sock_fd, sizeof(int)));
+ g_idle_add(__bt_send_rfcomm_server_fd, g_memdup2(&sock_fd, sizeof(int)));
else
- g_idle_add(__bt_send_rfcomm_server_fd_with_accept, g_memdup(&sock_fd, sizeof(int)));
+ g_idle_add(__bt_send_rfcomm_server_fd_with_accept, g_memdup2(&sock_fd, sizeof(int)));
BT_DBG("-");
return sock_fd;
*length = len;
BT_INFO("length = %d", *length);
- return g_memdup(data, *length);
+ return g_memdup2(data, *length);
}
static void __bt_tds_set_scan_resp_data(bt_tds_provider_t *provider)