From a56302e7cb070c1fc92a041007af0893c61dfb94 Mon Sep 17 00:00:00 2001 From: Abhishek Chandra Date: Tue, 18 Sep 2018 15:13:57 +0530 Subject: [PATCH] Prevent Issue fixes Prevent Issue fixes : - 1026071 - 1026065 - 1026059 - 1026057 - 1026047 - 1026042 - 1026038 Change-Id: I4517e99e89e5ad5a1fefe07fc2263c27587e61ab Signed-off-by: Abhishek Chandra --- bt-api/bt-gatt-client.c | 7 ++--- bt-oal/bluez_hal/src/bt-hal-gatt-client.c | 34 ++++++++++++---------- .../services/bt-request-handler.c | 1 + 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/bt-api/bt-gatt-client.c b/bt-api/bt-gatt-client.c index 3f92e17..9e3d0d8 100755 --- a/bt-api/bt-gatt-client.c +++ b/bt-api/bt-gatt-client.c @@ -2327,19 +2327,18 @@ BT_EXPORT_API int bluetooth_gatt_client_watch_characteristics( if (result != BLUETOOTH_ERROR_NONE) { BT_ERR("Fail to send request"); + BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param); return result; } else if (NULL == out_fd_list) { BT_ERR("out_fd_list is NULL"); + result = BLUETOOTH_ERROR_INTERNAL; } else { int *fd_list_array; int len = 0; int mtu; - int fd = -1;; - - if (!out_fd_list) - return BLUETOOTH_ERROR_INTERNAL; + int fd = -1; fd_list_array = g_unix_fd_list_steal_fds(out_fd_list, &len); BT_INFO("Num fds in fd_list is : %d, fd_list[0]: %d", len, fd_list_array[0]); diff --git a/bt-oal/bluez_hal/src/bt-hal-gatt-client.c b/bt-oal/bluez_hal/src/bt-hal-gatt-client.c index 633ec00..cc5b5b8 100644 --- a/bt-oal/bluez_hal/src/bt-hal-gatt-client.c +++ b/bt-oal/bluez_hal/src/bt-hal-gatt-client.c @@ -3421,25 +3421,27 @@ void _bt_hal_handle_gattc_value_changed_event(int result, const char *char_handl _bt_hal_convert_addr_string_to_type(bd_addr.address, device_address); conn_info = __bt_find_gatt_conn_info(&bd_addr); - //find service for notified char path - for (l = conn_info->gatt_list_services; l != NULL; l = g_slist_next(l)) { - svc_info = (hal_gattc_service_t*)l->data; - if (svc_info == NULL) - continue; - - /* find characteristic object path */ - for (k = svc_info->gatt_list_chars; k != NULL; k = g_slist_next(k)) { - char_info = (hal_gattc_char_t *)k->data; - if (char_info == NULL) + if (conn_info != NULL) { + //find service for notified char path + for (l = conn_info->gatt_list_services; l != NULL; l = g_slist_next(l)) { + svc_info = (hal_gattc_service_t*)l->data; + if (svc_info == NULL) continue; - if (g_strcmp0(char_info->chr_path, char_handle) == 0) { - DBG("Found char handle[%s]", char_info->chr_path); + /* find characteristic object path */ + for (k = svc_info->gatt_list_chars; k != NULL; k = g_slist_next(k)) { + char_info = (hal_gattc_char_t *)k->data; + if (char_info == NULL) + continue; + + if (g_strcmp0(char_info->chr_path, char_handle) == 0) { + DBG("Found char handle[%s]", char_info->chr_path); - //send event - _bt_hal_send_value_changed_event(conn_info, svc_info, - char_info, char_value, len); - return; + //send event + _bt_hal_send_value_changed_event(conn_info, svc_info, + char_info, char_value, len); + return; + } } } } diff --git a/bt-service-adaptation/services/bt-request-handler.c b/bt-service-adaptation/services/bt-request-handler.c index a5ad048..1428e4a 100644 --- a/bt-service-adaptation/services/bt-request-handler.c +++ b/bt-service-adaptation/services/bt-request-handler.c @@ -2446,6 +2446,7 @@ int __bt_bluez_request(int function_name, /* Add socket fd to unix_fd_list */ fd_list = g_unix_fd_list_new(); g_unix_fd_list_append(fd_list, fd, &error); + g_assert_no_error(error); _bt_service_method_return_with_unix_fd_list( context, *out_param1, result, fd_list); -- 2.7.4