Fix svace issues. 29/100829/1
authorDeokhyun Kim <dukan.kim@samsung.com>
Tue, 29 Nov 2016 10:04:38 +0000 (19:04 +0900)
committerDeokhyun Kim <dukan.kim@samsung.com>
Tue, 29 Nov 2016 10:04:53 +0000 (19:04 +0900)
Change-Id: I8a3b5d42472a85ccbc907539409d612a7b9aff84
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
bt-service/bt-service-event-receiver.c

index a60e917..5f9c82e 100644 (file)
@@ -951,11 +951,12 @@ static void __bt_device_property_changed_event(GVariant *msg, const char *path)
                        _bt_convert_device_path_to_address(path, address);
                        BT_DBG("address: %s", address);
 
+                       g_free(address);
+
                        remote_dev_info = _bt_get_remote_device_info_by_object_path(path);
                        if (remote_dev_info == NULL) {
                                g_free(property);
                                g_variant_unref(val);
-                               g_free(address);
                                return;
                        }
                        BT_DBG("Address type  %d", remote_dev_info->addr_type);
@@ -974,7 +975,6 @@ static void __bt_device_property_changed_event(GVariant *msg, const char *path)
                                                _bt_free_device_info(remote_dev_info);
                                                g_free(property);
                                                g_variant_unref(val);
-                                               g_free(address);
                                                return;
                                        }
                                }
@@ -1011,7 +1011,6 @@ static void __bt_device_property_changed_event(GVariant *msg, const char *path)
                                _bt_send_event(BT_ADAPTER_EVENT,
                                        BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND,
                                        param);
-                               g_free(address);
                        }
                        _bt_free_device_info(remote_dev_info);
                } else if (strcasecmp(property, "GattConnected") == 0) {
@@ -1317,7 +1316,7 @@ static void _bt_handle_pxp_property_changed_event(GVariant *msg, const char *pat
 {
        int result = BLUETOOTH_ERROR_NONE;
        int service_type;
-       int alert_lvl;
+       int alert_lvl = -1;
        GVariantIter value_iter;
        char *property = NULL;
        char *address;
@@ -1344,7 +1343,8 @@ static void _bt_handle_pxp_property_changed_event(GVariant *msg, const char *pat
                                service_type = BT_PXP_PROPERTY_IAS;
 
                        g_variant_get(val, "s", &alert_str);
-                       alert_lvl = get_alert_level_enum(alert_str);
+                       if (alert_str)
+                               alert_lvl = get_alert_level_enum(alert_str);
 
                        param = g_variant_new("(isiii)", result, address,
                                                                role, service_type, alert_lvl);