plugin handler: Fix resource leak because of payload 31/224231/1
authorAbhay Agarwal <ay.agarwal@samsung.com>
Wed, 29 Jan 2020 05:22:23 +0000 (10:52 +0530)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 7 Feb 2020 06:46:16 +0000 (15:46 +0900)
Change-Id: Ife96b4762153e52fc26babff1ddf6ce0a79f9f3b
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
ua-daemon/src/pm/ua-ble-plugin-handler.c
ua-daemon/src/pm/ua-plugin-manager.c
ua-daemon/src/pm/ua-pm-util.c

index c4d62e2..aab1afe 100644 (file)
@@ -98,6 +98,7 @@ static void ble_device_detection_callback(uas_detection_type_e type, uas_device_
        }
 
        g_free(dev_info);
+       g_free(payload);
        FUNC_EXIT;
 }
 
index f378551..8a7ac40 100644 (file)
@@ -436,9 +436,9 @@ int _uam_pm_register_device(int user_id, const uam_device_info_s *dev)
        device->user_id = user_id;
 
        ret = plugin->api->add_device(device);
-       if (UAS_STATUS_SUCCESS != ret) {
+
+       if (UAS_STATUS_SUCCESS != ret)
                UAM_ERR("plugin->add_device() failed");
-       }
 
        _pm_util_uas_device_info_free(device);
 
@@ -468,9 +468,9 @@ int _uam_pm_unregister_device(int user_id, const uam_device_info_s *dev)
        device->user_id = user_id;
 
        ret = plugin->api->remove_device(device);
-       if (UAS_STATUS_SUCCESS != ret && UAS_STATUS_ALREADY_DONE != ret) {
+
+       if (UAS_STATUS_SUCCESS != ret && UAS_STATUS_ALREADY_DONE != ret)
                UAM_ERR("plugin->remove_device() failed");
-       }
 
        _pm_util_uas_device_info_free(device);
 
index fa8a74c..ed4cf30 100644 (file)
@@ -400,9 +400,9 @@ uam_sensor_info_s *_pm_util_uas_sensor_info_to_uam_sensor_info(
        sensor_info->timestamp = info->timestamp;
        sensor_info->accuracy = info->accuracy;
        sensor_info->count = info->count;
-       for (i = 0; i < info->count; i++) {
+
+       for (i = 0; i < info->count; i++)
                sensor_info->values[i] = info->values[i];
-       }
 
        UAM_INFO("t [%llu] Accuaracy [%d] Count [%d] Lux [%f] CCT [%f] Lv[%f] Cv[%f]",
                sensor_info->timestamp, sensor_info->accuracy, sensor_info->count,