From: Abhay Agarwal Date: Wed, 29 Jan 2020 05:22:23 +0000 (+0530) Subject: plugin handler: Fix resource leak because of payload X-Git-Tag: accepted/tizen/unified/20200210.131729~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b013b14a4a41a144e624f97f2f47c908d4e048fd;p=platform%2Fcore%2Fconnectivity%2Fua-manager.git plugin handler: Fix resource leak because of payload Change-Id: Ife96b4762153e52fc26babff1ddf6ce0a79f9f3b Signed-off-by: Abhay Agarwal --- diff --git a/ua-daemon/src/pm/ua-ble-plugin-handler.c b/ua-daemon/src/pm/ua-ble-plugin-handler.c index c4d62e2..aab1afe 100644 --- a/ua-daemon/src/pm/ua-ble-plugin-handler.c +++ b/ua-daemon/src/pm/ua-ble-plugin-handler.c @@ -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; } diff --git a/ua-daemon/src/pm/ua-plugin-manager.c b/ua-daemon/src/pm/ua-plugin-manager.c index f378551..8a7ac40 100644 --- a/ua-daemon/src/pm/ua-plugin-manager.c +++ b/ua-daemon/src/pm/ua-plugin-manager.c @@ -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); diff --git a/ua-daemon/src/pm/ua-pm-util.c b/ua-daemon/src/pm/ua-pm-util.c index fa8a74c..ed4cf30 100644 --- a/ua-daemon/src/pm/ua-pm-util.c +++ b/ua-daemon/src/pm/ua-pm-util.c @@ -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,