Merge "Fix NULL Returns in bt-api/bt-hid-device.c" into tizen
authorPyun DoHyun <dh79.pyun@samsung.com>
Wed, 24 Jun 2015 04:53:05 +0000 (21:53 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 24 Jun 2015 04:53:05 +0000 (21:53 -0700)
bt-core/bt-core-noti-handler.c
bt-service/bt-service-common.c
bt-service/bt-service-device.c

index 467bb8b..3c5e618 100644 (file)
@@ -309,7 +309,7 @@ void _bt_core_handle_flight_mode_noti(void)
 void _bt_core_handle_power_saving_mode_noti(void)
 {
 #ifndef TIZEN_WEARABLE
-       int ret;
+       int ret = 0;
 
        BT_DBG("+");
 #ifdef ENABLE_TIZEN_2_4
index 621abf9..c5ffe0f 100644 (file)
@@ -139,9 +139,6 @@ static GDBusProxy *__bt_init_adapter_proxy(void)
                retv_if(system_conn == NULL, NULL);
        }
 
-       manager_proxy = _bt_get_manager_proxy();
-       retv_if(manager_proxy == NULL, NULL);
-
        adapter_path = _bt_get_adapter_path();
        retv_if(adapter_path == NULL, NULL);
 
@@ -171,9 +168,6 @@ static GDBusProxy *__bt_init_adapter_properties_proxy(void)
                retv_if(system_conn == NULL, NULL);
        }
 
-       manager_proxy = _bt_get_manager_proxy();
-       retv_if(manager_proxy == NULL, NULL);
-
        adapter_path = _bt_get_adapter_path();
        retv_if(adapter_path == NULL, NULL);
 
index c417ebf..8a2fd79 100644 (file)
@@ -633,7 +633,7 @@ static void __bt_bond_device_cb(GDBusProxy *proxy, GAsyncResult *res,
        GVariant *out_param1;
        request_info_t *req_info;
        bluetooth_device_info_t dev_info;
-       bt_remote_dev_info_t *remote_dev_info;
+       bt_remote_dev_info_t *remote_dev_info = NULL;
        GVariant *manufacture_data;
        GVariant *param;
 
@@ -733,6 +733,10 @@ static void __bt_bond_device_cb(GDBusProxy *proxy, GAsyncResult *res,
                goto dbus_return;
 
        remote_dev_info = _bt_get_remote_device_info(bonding_info->addr);
+       if (NULL == remote_dev_info) {
+               BT_ERR("Failed to get remote device info");
+               goto dbus_return;
+       }
 
        GVariant *uuids = NULL;
        GVariantBuilder *builder = NULL;
@@ -763,14 +767,11 @@ static void __bt_bond_device_cb(GDBusProxy *proxy, GAsyncResult *res,
 
 
        /* Send the event to application */
-       if (remote_dev_info != NULL) {
-
-               _bt_send_event(BT_ADAPTER_EVENT,
-                       BLUETOOTH_EVENT_BONDING_FINISHED,
-                       param);
+       _bt_send_event(BT_ADAPTER_EVENT,
+               BLUETOOTH_EVENT_BONDING_FINISHED,
+               param);
 
-               _bt_free_device_info(remote_dev_info);
-       }
+       _bt_free_device_info(remote_dev_info);
 
 dbus_return:
        if (req_info->context == NULL)
@@ -1100,7 +1101,7 @@ static void __bt_discover_cb(GDBusProxy *proxy, GAsyncResult *res,
        GVariant *out_param1;
        int result = BLUETOOTH_ERROR_NONE;
        bluetooth_device_info_t dev_info;
-       bt_remote_dev_info_t *remote_dev_info;
+       bt_remote_dev_info_t *remote_dev_info = NULL;
        request_info_t *req_info;
        GVariant *uuid_list, *manufacture_data;
        GVariant *param;
@@ -1150,6 +1151,10 @@ static void __bt_discover_cb(GDBusProxy *proxy, GAsyncResult *res,
        }
 
        remote_dev_info = _bt_get_remote_device_info(searching_info->addr);
+       if (NULL == remote_dev_info) {
+               BT_ERR("Failed to get remote device info");
+               goto dbus_return;
+       }
 
 event:
        builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
@@ -1178,14 +1183,11 @@ event:
 
 
        /* Send the event to application */
-       if (remote_dev_info != NULL) {
+       _bt_send_event(BT_ADAPTER_EVENT,
+               BLUETOOTH_EVENT_SERVICE_SEARCHED,
+               param);
 
-               _bt_send_event(BT_ADAPTER_EVENT,
-                       BLUETOOTH_EVENT_SERVICE_SEARCHED,
-                       param);
-
-               _bt_free_device_info(remote_dev_info);
-       }
+       _bt_free_device_info(remote_dev_info);
 
 dbus_return:
        if (req_info->context == NULL)