From: Hyuk Lee Date: Tue, 3 Apr 2018 05:36:42 +0000 (+0900) Subject: [UTC][Bluetooth][SVACE]Add the NULL check X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6adc01170bf6e87c179cc7a07dca7d986eb7de56;p=test%2Ftct%2Fnative%2Fapi.git [UTC][Bluetooth][SVACE]Add the NULL check Change-Id: Ibd47429ce26876e962f93502dc912d64561bcff1 Signed-off-by: Hyuk Lee --- diff --git a/src/utc/bluetooth/utc_bluetooth_adapter_positive.c b/src/utc/bluetooth/utc_bluetooth_adapter_positive.c index a810359..824e95c 100755 --- a/src/utc/bluetooth/utc_bluetooth_adapter_positive.c +++ b/src/utc/bluetooth/utc_bluetooth_adapter_positive.c @@ -1597,42 +1597,44 @@ static bt_adapter_le_device_scan_result_info_s* __bt_create_le_device_scan_info_ scan_info->rssi = -31; scan_info->adv_data_len = 31; scan_info->adv_data = malloc(scan_info->adv_data_len); - - scan_info->adv_data[0] = 28; - scan_info->adv_data[1] = 0xff; - - /* Company ID 0x004C */ - scan_info->adv_data[2] = 0x4c; - scan_info->adv_data[3] = 0x00; - - /* UUID */ - scan_info->adv_data[4] = 0x01; - scan_info->adv_data[5] = 0x01; - scan_info->adv_data[6] = 0x01; - scan_info->adv_data[7] = 0x01; - scan_info->adv_data[8] = 0x01; - scan_info->adv_data[9] = 0x01; - scan_info->adv_data[10] = 0x01; - scan_info->adv_data[11] = 0x01; - scan_info->adv_data[12] = 0x01; - scan_info->adv_data[13] = 0x01; - scan_info->adv_data[14] = 0x01; - scan_info->adv_data[15] = 0x01; - scan_info->adv_data[16] = 0x01; - scan_info->adv_data[17] = 0x01; - scan_info->adv_data[18] = 0x01; - scan_info->adv_data[19] = 0x01; - - /* Major ID */ - scan_info->adv_data[20] = 0x02; - scan_info->adv_data[21] = 0x01; - - /* Minor ID */ - scan_info->adv_data[22] = 0x02; - scan_info->adv_data[23] = 0x01; - - /* Power */ - scan_info->adv_data[24] = -31; + if (scan_info->adv_data) { + + scan_info->adv_data[0] = 28; + scan_info->adv_data[1] = 0xff; + + /* Company ID 0x004C */ + scan_info->adv_data[2] = 0x4c; + scan_info->adv_data[3] = 0x00; + + /* UUID */ + scan_info->adv_data[4] = 0x01; + scan_info->adv_data[5] = 0x01; + scan_info->adv_data[6] = 0x01; + scan_info->adv_data[7] = 0x01; + scan_info->adv_data[8] = 0x01; + scan_info->adv_data[9] = 0x01; + scan_info->adv_data[10] = 0x01; + scan_info->adv_data[11] = 0x01; + scan_info->adv_data[12] = 0x01; + scan_info->adv_data[13] = 0x01; + scan_info->adv_data[14] = 0x01; + scan_info->adv_data[15] = 0x01; + scan_info->adv_data[16] = 0x01; + scan_info->adv_data[17] = 0x01; + scan_info->adv_data[18] = 0x01; + scan_info->adv_data[19] = 0x01; + + /* Major ID */ + scan_info->adv_data[20] = 0x02; + scan_info->adv_data[21] = 0x01; + + /* Minor ID */ + scan_info->adv_data[22] = 0x02; + scan_info->adv_data[23] = 0x01; + + /* Power */ + scan_info->adv_data[24] = -31; + } return scan_info; }