Prevent Issue fixes 27/189527/2
authorAbhishek Chandra <abhishek.ch@samsung.com>
Tue, 18 Sep 2018 09:43:57 +0000 (15:13 +0530)
committerAbhishek Chandra <abhishek.ch@samsung.com>
Tue, 18 Sep 2018 10:02:51 +0000 (15:32 +0530)
Prevent Issue fixes :
- 1026071
- 1026065
- 1026059
- 1026057
- 1026047
- 1026042
- 1026038

Change-Id: I4517e99e89e5ad5a1fefe07fc2263c27587e61ab
Signed-off-by: Abhishek Chandra <abhishek.ch@samsung.com>
bt-api/bt-gatt-client.c
bt-oal/bluez_hal/src/bt-hal-gatt-client.c
bt-service-adaptation/services/bt-request-handler.c

index 3f92e17..9e3d0d8 100755 (executable)
@@ -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]);
index 633ec00..cc5b5b8 100644 (file)
@@ -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;
+                               }
                        }
                }
        }
index a5ad048..1428e4a 100644 (file)
@@ -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);