BT_CHECK_INPUT_PARAMETER(advertiser);
__adv = (bt_advertiser_s *)g_malloc0(sizeof(bt_advertiser_s));
- if (__adv == NULL) {
- BT_ERR("OUT_OF_MEMORY(0x%08x)",
- BT_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */
- return BT_ERROR_OUT_OF_MEMORY; /* LCOV_EXCL_LINE */
- }
__adv->handle = GPOINTER_TO_INT(__adv);
*advertiser = (bt_advertiser_h)__adv;
unsigned short val;
char *stop;
data = g_malloc0(sizeof(char) *2);
- if (data == NULL)
- return BT_ERROR_OUT_OF_MEMORY; /* LCOV_EXCL_LINE */
val = strtol(string, &stop, 16);
val = htons(val);
unsigned int val0, val4;
unsigned short val1, val2, val3, val5;
data = g_malloc0(sizeof(char) *16);
- /* Fix : NULL_RETURNS */
- if (data == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
/* UUID format : %08x-%04hx-%04hx-%04hx-%08x%04hx */
strncpy(str_ptr, string, 36);
/* Convert to little endian */
swp = g_malloc0(data_len);
- /* Fix : NULL_RETURNS */
- if (swp == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
for (i = 0, j = data_len - 1; i < data_len; i++, j--)
swp[i] = data[j];
}
new_adv = g_malloc0(adv_len + new_data_len);
- if (!new_adv)
- return BT_ERROR_OUT_OF_MEMORY;
for (i = 0; i < adv_len; i++) {
len = adv_data[i];
g_free(uuid_ptr);
adv_data = g_malloc0(sizeof(char) *(service_data_len + 2));
- if (!adv_data) {
- g_free(converted_uuid); /* LCOV_EXCL_LINE */
- return BT_ERROR_OUT_OF_MEMORY;
- }
memcpy(adv_data, converted_uuid, 2);
memcpy(adv_data + 2, service_data, service_data_len);
}
adv_data = g_malloc0(sizeof(char) *(manufacturer_data_len + 2));
- if (!adv_data)
- return BT_ERROR_OUT_OF_MEMORY;
adv_data[0] = manufacturer_id & 0xffffffff;
adv_data[1] = (manufacturer_id & 0xff00) >> 8;
return BT_ERROR_NO_DATA;
*uuids = g_malloc0(sizeof(char *) *uuid_count);
- /* Fix : NULL_RETURNS */
- if (*uuids == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
*count = uuid_count;
if (uuid_size != 0) {
for (i = 0; i < (field_len - 1); i += uuid_size) {
if (uuid_size == 2) {
- (*uuids)[uuid_index] = g_malloc0(sizeof(char) *4 + 1);
- /* Fix : NULL_RETURNS */
- if ((*uuids)[uuid_index] == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
+ (*uuids)[uuid_index] = g_malloc0(sizeof(char) * 4 + 1);
snprintf((*uuids)[uuid_index], 5,
"%2.2X%2.2X",
remain_data[i+3],
remain_data[i+2]);
} else {
- (*uuids)[uuid_index] = g_malloc0(sizeof(char) *36 + 1);
- /* Fix : NULL_RETURNS */
- if ((*uuids)[uuid_index] == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
+ (*uuids)[uuid_index] = g_malloc0(sizeof(char) * 36 + 1);
snprintf((*uuids)[uuid_index], 37, "%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X",
remain_data[i+17], remain_data[i+16], remain_data[i+15], remain_data[i+14],
remain_data[i+13], remain_data[i+12], remain_data[i+11], remain_data[i+10], remain_data[i+9], remain_data[i+8],
if (adv_data[1] == BT_ADAPTER_LE_ADVERTISING_DATA_LOCAL_NAME ||
adv_data[1] == BT_ADAPTER_LE_ADVERTISING_DATA_SHORT_LOCAL_NAME) {
*name = g_malloc0(sizeof(char) *field_len);
- /* Fix : NULL_RETURNS */
- if (*name == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
memcpy(*name, &adv_data[2], field_len - 1);
return BT_ERROR_NONE;
if (uuid_count == 0)
return BT_ERROR_NO_DATA;
- *uuids = g_malloc0(sizeof(char *) *uuid_count);
- /* Fix : NULL_RETURNS */
- if (*uuids == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
+ *uuids = g_malloc0(sizeof(char *) * uuid_count);
*count = uuid_count;
remain_data = adv_data;
if (uuid_size != 0) {
for (i = 0; i < (field_len - 1); i += uuid_size) {
if (uuid_size == 2) {
- (*uuids)[uuid_index] = g_malloc0(sizeof(char) *4 + 1);
- /* Fix : NULL_RETURNS */
- if ((*uuids)[uuid_index] == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
+ (*uuids)[uuid_index] = g_malloc0(sizeof(char) * 4 + 1);
snprintf((*uuids)[uuid_index], 5,
"%2.2X%2.2X", remain_data[i+3],
remain_data[i+2]);
} else {
- (*uuids)[uuid_index] = g_malloc0(sizeof(char) *36 + 1);
- /* Fix : NULL_RETURNS */
- if ((*uuids)[uuid_index] == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
+ (*uuids)[uuid_index] = g_malloc0(sizeof(char) * 36 + 1);
snprintf((*uuids)[uuid_index], 37, "%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X",
remain_data[i+17], remain_data[i+16], remain_data[i+15], remain_data[i+14],
remain_data[i+13], remain_data[i+12], remain_data[i+11], remain_data[i+10], remain_data[i+9], remain_data[i+8],
if (data_count == 0)
return BT_ERROR_NO_DATA;
- *data_list = g_malloc0(sizeof(bt_adapter_le_service_data_s) *data_count);
- /* Fix : NULL_RETURNS */
- if (*data_list == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
+ *data_list = g_malloc0(sizeof(bt_adapter_le_service_data_s) * data_count);
*count = data_count;
remain_data = adv_data;
return BT_ERROR_NO_DATA;
*ibeacon_info = g_malloc0(sizeof(bt_adapter_le_ibeacon_scan_result_info_s));
- if (*ibeacon_info == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
(*ibeacon_info)->company_id = manufacturer_id;
(*ibeacon_info)->ibeacon_type = manufacturer_data[1] << 8;
(*ibeacon_info)->ibeacon_type += manufacturer_data[0];
- (*ibeacon_info)->uuid = g_malloc0(sizeof(char) *36 + 1);
- if ((*ibeacon_info)->uuid == NULL) {
- g_free(*ibeacon_info);
- return BT_ERROR_OUT_OF_MEMORY;
- }
+ (*ibeacon_info)->uuid = g_malloc0(sizeof(char) * 36 + 1);
snprintf((*ibeacon_info)->uuid, 37, "%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X",
manufacturer_data[17], manufacturer_data[16], manufacturer_data[15], manufacturer_data[14],
BT_CHECK_INPUT_PARAMETER(scan_filter);
__filter = (bt_le_scan_filter_s *)g_malloc0(sizeof(bt_le_scan_filter_s));
- if (__filter == NULL) {
- BT_ERR("OUT_OF_MEMORY(0x%08x)",
- BT_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */
- return BT_ERROR_OUT_OF_MEMORY;
- }
__filter->manufacturer_id = -1;
*scan_filter = (bt_scan_filter_h)__filter;
*val_len = fmt_size;
} else if (*val_len == offset) { /* Added */
tmp = g_malloc0(*val_len + fmt_size);
- /* Fix : NULL_RETURNS */
- if (!tmp) {
- g_free(*val);
- return BT_ERROR_OUT_OF_MEMORY;
- }
memcpy(tmp, *val, *val_len);
g_free(*val);
*val = tmp;
*val_len += fmt_size;
} else if (*val_len < offset + fmt_size) {/* Overlapped */
tmp = g_malloc0(offset + fmt_size);
- /* Fix : NULL_RETURNS */
- if (!tmp) {
- g_free(*val);
- return BT_ERROR_OUT_OF_MEMORY;
- }
memcpy(tmp, *val, *val_len);
g_free(*val);
*val = tmp;
if (*val == NULL) {
*val = g_malloc0(fmt_size);
- /* Fix : NULL_RETURNS */
- if (*val == NULL)
- return BT_ERROR_OUT_OF_MEMORY;
*val_len = fmt_size;
} else if (*val_len == offset) {/* Added */
tmp = g_malloc0(*val_len + fmt_size);
- /* Fix : NULL_RETURNS */
- if (tmp == NULL) {
- g_free(*val);
- return BT_ERROR_OUT_OF_MEMORY;
- }
memcpy(tmp, *val, *val_len);
g_free(*val);
*val = tmp;
*val_len += fmt_size;
} else if (*val_len < offset + fmt_size) {/* Overlapped */
tmp = g_malloc0(offset + fmt_size);
- /* Fix : NULL_RETURNS */
- if (tmp == NULL) {
- g_free(*val);
- return BT_ERROR_OUT_OF_MEMORY;
- }
memcpy(tmp, *val, *val_len);
g_free(*val);
*val = tmp;