summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoHyun Pyun <dh79.pyun@samsung.com>2017-09-27 10:23:25 +0900
committerDoHyun Pyun <dh79.pyun@samsung.com>2017-09-27 10:23:25 +0900
commit062afbd383ddf3a1f95e3bcb491b1d4bcc663dd6 (patch)
tree6e789981f316bf5b007699e1f06989f0934890c6
parent19e7c6271fbcc1043e8fc372c2d0f35d9f1b7ab8 (diff)
downloadbluetooth-062afbd383ddf3a1f95e3bcb491b1d4bcc663dd6.tar.gz
bluetooth-062afbd383ddf3a1f95e3bcb491b1d4bcc663dd6.tar.bz2
bluetooth-062afbd383ddf3a1f95e3bcb491b1d4bcc663dd6.zip
Fix the prevent issuessubmit/tizen_4.0/20170927.034808
Change-Id: Ie2c4e834e35cdc04a301801b961e7ceb3f130c43 Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
-rw-r--r--src/bluetooth-adapter.c15
-rw-r--r--src/bluetooth-map-client.c8
2 files changed, 16 insertions, 7 deletions
diff --git a/src/bluetooth-adapter.c b/src/bluetooth-adapter.c
index ce9fc4e..0f71324 100644
--- a/src/bluetooth-adapter.c
+++ b/src/bluetooth-adapter.c
@@ -3308,7 +3308,7 @@ int bt_adapter_le_get_scan_result_ibeacon_report(const bt_adapter_le_device_scan
bt_adapter_le_packet_type_e pkt_type, bt_adapter_le_ibeacon_scan_result_info_s **ibeacon_info)
{
int manufacturer_id;
- char *manufacturer_data;
+ char *manufacturer_data = NULL;
int manufacturer_data_len;
BT_CHECK_LE_SUPPORT();
@@ -3320,11 +3320,18 @@ int bt_adapter_le_get_scan_result_ibeacon_report(const bt_adapter_le_device_scan
&manufacturer_data_len) != BT_ERROR_NONE)
return BT_ERROR_NO_DATA;
- if (manufacturer_data == NULL || manufacturer_data_len < 23)
+ if (manufacturer_data == NULL)
return BT_ERROR_NO_DATA;
- if (manufacturer_id != COMPANY_ID_APPLE)
+ if (manufacturer_data_len < 23) {
+ bt_adapter_free_manufacturer_data(manufacturer_data);
return BT_ERROR_NO_DATA;
+ }
+
+ if (manufacturer_id != COMPANY_ID_APPLE) {
+ bt_adapter_free_manufacturer_data(manufacturer_data);
+ return BT_ERROR_NO_DATA;
+ }
*ibeacon_info = g_malloc0(sizeof(bt_adapter_le_ibeacon_scan_result_info_s));
@@ -3347,6 +3354,8 @@ int bt_adapter_le_get_scan_result_ibeacon_report(const bt_adapter_le_device_scan
(*ibeacon_info)->measured_power = manufacturer_data[22];
+ bt_adapter_free_manufacturer_data(manufacturer_data);
+
return BT_ERROR_NONE; /* LCOV_EXCL_STOP */
}
diff --git a/src/bluetooth-map-client.c b/src/bluetooth-map-client.c
index 9cc1cf8..a7e92dd 100644
--- a/src/bluetooth-map-client.c
+++ b/src/bluetooth-map-client.c
@@ -333,16 +333,16 @@ int bt_map_client_get_message(bt_map_client_session_info_h handle,
bt_map_client_session_info_s* session = (bt_map_client_session_info_s*) handle;
- bt_get_message_callback_data *data = g_malloc(sizeof(*data));
- data->target_file = target_file;
- data->user_data = user_data;
-
int error_code = _bt_get_error_code(bluetooth_map_client_get_message(session,
message_object, target_file, attachment));
if (error_code != BT_ERROR_NONE) {
BT_ERR("bt_map_client_get_message %s(0x%08x)", _bt_convert_error_to_string(error_code),
error_code);
} else {
+ bt_get_message_callback_data *data = g_malloc(sizeof(*data));
+ data->target_file = target_file;
+ data->user_data = user_data;
+
_bt_set_cb(BT_EVENT_MAP_CLIENT_GET_MESSAGE, callback, data);
}