BT_DBG("Call count = %d", call_count);
*call_list = g_malloc0(sizeof(bt_hf_call_list_s));
- /* Fix : NULL_RETURNS */
- retv_if(*call_list == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
-
(*call_list)->count = call_count;
g_variant_iter_init(&iter, var_temp);
bt_hf_call_status_info_t *call_info;
call_info = g_malloc0(sizeof(bt_hf_call_status_info_t));
- /* Fix : NULL_RETURNS */
- retv_if(call_info == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
-
call_info->number = g_strdup(num);
call_info->direction = dir;
call_info->status = status;
}
handle = (bt_hf_call_list_s *)list;
call_status = g_malloc0(sizeof(bt_hf_call_status_info_t));
- /* Fix : NULL_RETURNS */
- retv_if(call_status == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
-
call_status->number = g_strdup(number);
call_status->direction = dir;
call_status->status = status;
manufacturer_data = (char *)g_variant_get_data(manufacturer_var);
dev_info = g_malloc0(sizeof(bluetooth_device_info_t));
- /* Fix : NULL_RETURNS */
- if (dev_info == NULL) {
- result = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto done;
- }
-
dev_info->rssi = rssi;
dev_info->paired = paired;
dev_info->connected = connected;
if (manufacturer_data)
for (i = 0; i < manufacturer_data_len; i++)
dev_info->manufacturer_data.data[i] = manufacturer_data[i];
-done:
*ret = result;
g_free(uuids);
g_variant_unref(string_var);
scan_data = (char *)g_variant_get_data(scan_var);
le_dev_info = g_malloc0(sizeof(bluetooth_le_device_info_t));
- /* Fix : NULL_RETURNS */
- if (le_dev_info == NULL) {
- result = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto done;
- }
_bt_convert_addr_string_to_type(le_dev_info->device_address.addr, address);
le_dev_info->addr_type = addr_type;
le_dev_info->rssi = rssi;
if (scan_data)
le_dev_info->scan_resp_data.data.data[i] = scan_data[i];
-done:
*ret = result;
-
g_variant_unref(adv_var);
g_variant_unref(scan_var);
return le_dev_info;
/* Fix : FORWARD_NULL : g_variant_get_data can return NULL */
if (char_val.val_len > 0 && value != NULL) {
char_val.char_value = (unsigned char*) g_malloc0(char_val.val_len);
- /* Fix : NULL_RETURNS */
- if (char_val.char_value == NULL) {
- BT_ERR("BLUETOOTH_ERROR_OUT_OF_MEMORY");
- g_free(char_val.char_handle);
- g_variant_unref(char_value_var);
- return;
- }
memcpy(char_val.char_value, value, len);
_bt_common_event_cb(BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED,
result, &char_val,
path = g_malloc0((gp->len + 1) * sizeof(char *));
- /* Fix : NULL_RETURNS */
- if (path == NULL)
- return NULL;
-
for (i = 0; i < gp->len; i++) {
gp_path = g_ptr_array_index(gp, i);
path[i] = g_strdup(gp_path);
g_variant_get(value, "ay", &desc_value_iter);
len = g_variant_get_size((GVariant *)desc_value_iter);
- if (len > 0) {
+ if (len > 0)
characteristic->description = (char *)g_malloc0(len + 1);
- if (!characteristic->description) {
- ret = BLUETOOTH_ERROR_OUT_OF_MEMORY;
- goto done;
- }
- }
+
for (i = 0; i < len; i++) {
g_variant_iter_loop(desc_value_iter, "y",
&characteristic->description[i]);
}
}
-done:
g_variant_iter_free(property_iter);
g_variant_unref(result);
g_object_unref(properties_proxy);
if (dev_info == NULL) {
dev_info = (hid_connected_device_info_t *)
g_malloc0(sizeof(hid_connected_device_info_t));
- if (dev_info == NULL) {
- BT_ERR("Fail to allocation memory");
- return -1;
- }
dev_info->intr_fd = -1;
dev_info->ctrl_fd = -1;
else
socket_fd = info->ctrl_fd;
- send_event = (char*)g_malloc0(data_len + 2);
- if (send_event == NULL)
- return BLUETOOTH_ERROR_OUT_OF_MEMORY;
+ send_event = g_malloc0(data_len + 2);
send_event[0] = (char)btcode;
send_event[1] = (char)report_id;
BT_DBG("+");
event_info = g_malloc0(sizeof(bt_timer_info_t));
- /* Fix : NULL_RETURNS */
- ret_if(event_info == NULL);
_bt_delete_event_timer(event_id);
bt_remote_dev_info_t *dev_info;
dev_info = g_malloc0(sizeof(bt_remote_dev_info_t));
- retv_if(dev_info == NULL, NULL);
dev_info->rssi = sample_devices[index].rssi;
dev_info->class = sample_devices[index].class;
if (dev_info->manufacturer_data_len > 0) {
dev_info->manufacturer_data = g_malloc0(dev_info->manufacturer_data_len);
- if (dev_info->manufacturer_data)
- memcpy(dev_info->manufacturer_data, sample_devices[index].manufacturer_data,
- dev_info->manufacturer_data_len);
+ memcpy(dev_info->manufacturer_data, sample_devices[index].manufacturer_data,
+ dev_info->manufacturer_data_len);
}
return dev_info;
request_info_t *info;
info = g_malloc0(sizeof(request_info_t));
- /* Fix : NULL_RETURNS */
- retv_if(info == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
info->req_id = req_id;
info->service_function = service_function;
return -1;
}
slot_check_list = g_malloc0(sizeof(gboolean) * le_feature_info.max_filter);
- if (slot_check_list == NULL) {
- BT_ERR("Fail to allocate memory");
- return -1;
- }
for (l = scanner_list; l != NULL; l = g_slist_next(l)) {
scanner = l->data;
scanner = __bt_find_scanner_from_list(sender);
if (scanner == NULL) {
scanner = g_malloc0(sizeof(bt_adapter_le_scanner_t));
- if (scanner) {
- scanner->sender = strdup(sender);
- scanner_list = g_slist_append(scanner_list, scanner);
- }
+ scanner->sender = strdup(sender);
+ scanner_list = g_slist_append(scanner_list, scanner);
}
filter_data = g_malloc0(sizeof(bluetooth_le_scan_filter_t));
- if (filter_data) {
- memcpy(filter_data, filter, sizeof(bluetooth_le_scan_filter_t));
- filter_data->slot_id = *slot_id;
+ memcpy(filter_data, filter, sizeof(bluetooth_le_scan_filter_t));
+ filter_data->slot_id = *slot_id;
- if (scanner)
- scanner->filter_list = g_slist_append(scanner->filter_list, filter_data);
- }
+ if (scanner)
+ scanner->filter_list = g_slist_append(scanner->filter_list, filter_data);
if (ret)
g_variant_unref(ret);
if (scanner == NULL) {
scanner = g_malloc0(sizeof(bt_adapter_le_scanner_t));
- retv_if(scanner == NULL, BLUETOOTH_ERROR_INTERNAL);
-
scanner->sender = strdup(sender);
scanner_list = g_slist_append(scanner_list, scanner);
}
rewind(fp);
buffer = g_malloc0(sizeof(char) * size);
- /* Fix : NULL_RETURNS */
- if (buffer == NULL) {
- BT_ERR("Fail to allocate memory");
- fclose(fp);
- return FALSE;
- }
result = fread((char *)buffer, 1, size, fp);
fclose(fp);
if (result != size) {
}
connected_device = g_malloc0(sizeof(bt_connected_headset_data_t));
- /* Fix : NULL_RETURNS */
- if (connected_device == NULL) {
- BT_ERR("No memory allocated");
- return;
- }
-
connected_device->device_state = status;
if ((status == BT_STATE_CONNECTED) || (status == BT_STATE_CONNECTING))
connected_device->type |= type;
_bt_convert_addr_type_to_string(address, device_address->addr);
func_data = g_malloc0(sizeof(bt_audio_function_data_t));
- /* Fix : NULL_RETURNS */
- if (func_data == NULL) {
- result = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto fail;
- }
-
func_data->address = g_strdup(address);
func_data->req_id = request_id;
func_data->type = type;
_bt_convert_addr_type_to_string(address, device_address->addr);
func_data = g_malloc0(sizeof(bt_audio_function_data_t));
- /* Fix : NULL_RETURNS */
- if (func_data == NULL) {
- BT_ERR("Memory allocation error");
- result = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto fail;
- }
func_data->address = g_strdup(address);
func_data->req_id = request_id;
func_data->pending = BT_PENDING_NONE;
}
func_data = g_malloc0(sizeof(bt_function_data_t));
- /* Fix : NULL_RETURNS */
- if (func_data == NULL) {
- result = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto fail;
- }
-
func_data->address = g_strdup(address);
func_data->req_id = request_id;
uuid = g_strdup(HFP_AG_UUID);
}
func_data = g_malloc0(sizeof(bt_function_data_t));
- /* Fix : NULL_RETURNS */
- if (func_data == NULL) {
- result = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto fail;
- }
-
func_data->address = g_strdup(address);
func_data->req_id = request_id;
uuid = g_strdup(HFP_AG_UUID);
}
buffer = g_malloc0(sizeof(char) * size);
- /* Fix : NULL_RETURNS */
- if (buffer == NULL) {
- BT_ERR("Memory allocation error\n");
- fclose(fp);
- return FALSE;
- }
result = fread((char *)buffer, 1, size, fp);
fclose(fp);
if (result != size) {
/* allocate user data so that it can be retrieved in callback */
unbonding_info = g_malloc0(sizeof(bt_funcion_data_t));
- /* Fix : NULL_RETURNS */
- if (unbonding_info == NULL) {
- BT_ERR("Memory not allocated !");
- return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- }
-
unbonding_info->addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
unbonding_info->req_id = request_id;
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
func_data = g_malloc0(sizeof(bt_function_data_t));
- if (func_data == NULL) {
- BT_ERR("Unable to allocate memory for address");
- ret = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto fail;
- }
-
func_data->address = g_strdup(device_address);
if (func_data->address == NULL) {
BT_ERR("Unable to allocate memory for address");
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
func_data = g_malloc0(sizeof(bt_function_data_t));
- if (func_data == NULL) {
- BT_ERR("Unable to allocate memory for address");
- ret = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto fail;
- }
-
func_data->address = g_strdup(device_address);
if (func_data->address == NULL) {
BT_ERR("Unable to allocate memory for address");
/* Bonding from remote device */
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- if (address == NULL)
- return;
g_variant_get(msg, "(&o)", &object_path);
gboolean connected = FALSE;
char *address;
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
g_variant_get(msg, "(b)", &connected);
}
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
ret_if(_bt_is_device_creating() == TRUE);
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
g_variant_get(msg, "(y)", &addr_type);
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
dev_name = _bt_get_bonded_device_name(address);
result = disc_reason;
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
g_variant_get(msg, "(si)", &profile_uuid, &state);
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
_bt_convert_addr_string_to_type(bd_addr.addr, address);
ret_if(_bt_is_le_scanning() == FALSE);
le_dev_info = g_malloc0(sizeof(bt_remote_le_dev_info_t));
- if (le_dev_info == NULL)
- return;
g_variant_get(msg, "(syyii@ay)", &le_dev_info->address,
&le_dev_info->addr_type,
if (le_dev_info->adv_type != BT_LE_ADV_SCAN_RSP) { /* ADV_IND */
adv_info = g_malloc0(sizeof(bt_le_adv_info_t));
- if (adv_info == NULL) {
- _bt_free_le_device_info(le_dev_info);
- g_variant_unref(value);
- return;
- }
adv_info->addr = g_strdup(le_dev_info->address);
adv_info->addr_type = le_dev_info->addr_type;
adv_info->rssi = le_dev_info->rssi;
adv_info->data_len = le_dev_info->adv_data_len;
adv_info->data = g_malloc0(le_dev_info->adv_data_len);
- if (adv_info->data) {
- memcpy(adv_info->data, le_dev_info->adv_data,
- le_dev_info->adv_data_len);
- }
if (__bt_add_adv_ind_info(adv_info) == 0) {
adv_info->timer_id = g_timeout_add(1000,
g_variant_get(value, "b", &property_flag);
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- if (address == NULL)
- return;
_bt_convert_device_path_to_address(path, address);
_bt_convert_addr_string_to_type(bd_addr.addr, address);
_bt_is_le_scanning() == FALSE);
cache_info = g_malloc0(sizeof(bt_cache_info_t));
- ret_if(cache_info == NULL);
dev_info = g_malloc0(sizeof(bt_remote_dev_info_t));
- if (dev_info == NULL) {
- __bt_free_cache_info(cache_info);
- return;
- }
cache_info->dev_info = dev_info;
return FALSE;
server = g_malloc0(sizeof(bt_agent_osp_server_t));
- retv_if(server == NULL, FALSE);
-
server->type = type;
if (type == BT_RFCOMM_SERVER) {
server->uuid = g_strdup(uuid);
_bt_convert_addr_type_to_string(address, device_address->addr);
func_data = g_malloc0(sizeof(bt_function_data_t));
- /* Fix : NULL_RETURNS */
- retv_if(func_data == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
-
func_data->address = g_strdup(address);
func_data->req_id = request_id;
uuid = HID_UUID;
_bt_convert_addr_type_to_string(address, device_address->addr);
func_data = g_malloc0(sizeof(bt_function_data_t));
- /* Fix : NULL_RETURNS */
- retv_if(func_data == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
-
func_data->address = g_strdup(address);
func_data->req_id = request_id;
g_variant_unref(result);
retv_if(profile_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
func_data = g_malloc0(sizeof(bt_function_data_t));
- retv_if(func_data == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
-
func_data->address = g_strdup(address);
func_data->req_id = request_id;
g_variant_unref(result);
retv_if(profile_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
func_data = g_malloc0(sizeof(bt_function_data_t));
- retv_if(func_data == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
-
func_data->address = g_strdup(address);
func_data->req_id = request_id;
} else {
/* Insert data in the queue */
data = g_malloc0(sizeof(bt_sending_data_t));
- if (data == NULL)
- return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
-
data->file_path = g_new0(char *, file_count + 1);
data->address = g_strdup(address);
data->file_count = file_count;
request_info_t *info;
info = g_malloc0(sizeof(request_info_t));
- /* Fix : NULL_RETURNS */
- retv_if(info == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
-
info->req_id = req_id;
info->service_function = service_function;
info->context = context;
}
buf = g_malloc0(20);
- /* Fix : NULL_RETURNS */
- if (buf == NULL) {
- close(fd);
- return NULL;
- }
if (read(fd, buf, 17) < 17) {
perror("Can't load firmware");