bt-service: dpm: Fix Uninitialized variables 28/143628/2
authorSyam Sidhardhan <s.syam@samsung.com>
Mon, 31 Jul 2017 09:17:34 +0000 (14:47 +0530)
committerSyam Sidhardhan <s.syam@samsung.com>
Thu, 10 Aug 2017 17:02:19 +0000 (22:32 +0530)
Fix memory leak

[Problem] Fix uninitialized variable

[bt-service-dpm.c:177]: (error) Uninitialized variable: device_list
[bt-service-dpm.c:227]: (error) Uninitialized variable: device_list
[bt-service-dpm.c:222]: (error) Uninitialized variable: device_list
[bt-service-dpm.c:276]: (error) Uninitialized variable: device_list
+more

Change-Id: Iee9b8307fd8662b21f162a13c35b5379bc0ff817
Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
bt-service-emul/bt-service-dpm.c
bt-service/bt-service-dpm.c

index 42dee10..5ee1f79 100644 (file)
@@ -161,7 +161,7 @@ dpm_result_t _bt_dpm_add_bluetooth_devices_to_blacklist(bluetooth_device_address
 dpm_result_t _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1)
 {
        dpm_result_t ret = DPM_RESULT_FAIL;
-       bt_dpm_device_list_t device_list;
+       bt_dpm_device_list_t device_list = { 0, };
        GSList *list = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list;
        int i = 0;
 
@@ -211,7 +211,7 @@ dpm_result_t _bt_dpm_add_bluetooth_devices_to_whitelist(bluetooth_device_address
 dpm_result_t _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1)
 {
        dpm_result_t ret = DPM_RESULT_FAIL;
-       bt_dpm_device_list_t device_list;
+       bt_dpm_device_list_t device_list = { 0, };
        GSList *list = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list;
        int i = 0;
 
index 685acbb..6ed4bec 100644 (file)
@@ -205,7 +205,7 @@ int _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1)
 {
        int ret = BLUETOOTH_ERROR_INTERNAL;
        int allow_bt = DPM_BT_ERROR;
-       bt_dpm_device_list_t device_list;
+       bt_dpm_device_list_t device_list = { 0, };
        GSList *list = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list;
        int i = 0;
 
@@ -259,7 +259,7 @@ int _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1)
 {
        dpm_result_t ret = BLUETOOTH_ERROR_INTERNAL;
        int allow_bt = DPM_BT_ERROR;
-       bt_dpm_device_list_t device_list;
+       bt_dpm_device_list_t device_list = { 0, };
        GSList *list = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list;
        int i = 0;