Fix Side effect from "Fix Coverity issues" 18/209718/2 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix accepted/tizen_6.0_unified accepted/tizen_6.0_unified_hotfix accepted/tizen_6.5_unified accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix accepted/tizen_8.0_unified tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix tizen_6.0 tizen_6.0_hotfix tizen_6.5 tizen_7.0 tizen_7.0_hotfix tizen_8.0 accepted/tizen/5.5/unified/20191031.031250 accepted/tizen/5.5/unified/mobile/hotfix/20201027.065703 accepted/tizen/5.5/unified/wearable/hotfix/20201027.121550 accepted/tizen/6.0/unified/20201030.122425 accepted/tizen/6.0/unified/hotfix/20201103.004728 accepted/tizen/6.0/unified/hotfix/20201103.052008 accepted/tizen/6.5/unified/20211028.095057 accepted/tizen/7.0/unified/20221110.061553 accepted/tizen/7.0/unified/hotfix/20221116.104751 accepted/tizen/8.0/unified/20231005.092805 accepted/tizen/unified/20190711.062849 accepted/tizen/unified/dev/20240620.004246 submit/tizen/20190710.084405 submit/tizen_5.5/20191031.000002 submit/tizen_5.5_mobile_hotfix/20201026.185102 submit/tizen_5.5_wearable_hotfix/20201026.184302 submit/tizen_6.0/20201029.205102 submit/tizen_6.0_hotfix/20201102.192502 submit/tizen_6.0_hotfix/20201103.114802 submit/tizen_6.5/20211028.161801 tizen_5.5.m2_release tizen_6.0.m2_release tizen_6.5.m2_release tizen_7.0_m2_release tizen_8.0_m2_release
authorJung Jihoon <jh8801.jung@samsung.com>
Wed, 10 Jul 2019 07:52:39 +0000 (16:52 +0900)
committerJung Jihoon <jh8801.jung@samsung.com>
Wed, 10 Jul 2019 08:41:40 +0000 (17:41 +0900)
Change-Id: I67e9aade4eb955cd081dffad8ca996619684269f
Signed-off-by: Jung Jihoon <jh8801.jung@samsung.com>
test/main.c
test/mdg-manager.c

index 477af92..6714239 100644 (file)
@@ -33,6 +33,7 @@ extern struct menu_data menu_mdg_manager[];
 
 extern GList *found_group_list;
 extern GList *found_device_list;
+extern GList *found_invited_device_list;
 extern mdg_h handle;
 
 #define CASE_TO_STR(x) case x: return #x;
@@ -158,6 +159,8 @@ OUT:
                g_list_free_full(found_group_list, _free_group);
        if (found_device_list)
                g_list_free_full(found_device_list, _free_device);
+       if (found_invited_device_list)
+               g_list_free_full(found_invited_device_list, _free_device);
 
        mdg_deinitialize(handle);
 
index 9babdee..8006911 100755 (executable)
@@ -531,7 +531,9 @@ bool _device_found_cb(mdg_device_h device, void *user_data)
        }
 
        if (is_exist == FALSE) {
-               found_device_list = g_list_append(found_device_list, device);
+               mdg_device_h cloned_device;
+               mdg_device_info_clone(&cloned_device, device);
+               found_device_list = g_list_append(found_device_list, cloned_device);
                msgp("\r[ID] %s [Type] %s [Name] %s", device_id,
                        __device_type_to_string(device_type), model_name);
        }
@@ -730,6 +732,7 @@ static void _destroy_mdg_group_info(gpointer data)
 bool _group_found_cb(mdg_group_type_e type, mdg_group_h group, void *user_data)
 {
        char *group_name;
+       mdg_group_h cloned_group;
 
        mdg_group_info_get_name(group, &group_name);
 
@@ -738,7 +741,9 @@ bool _group_found_cb(mdg_group_type_e type, mdg_group_h group, void *user_data)
        else
                msgp("\rfound group type : REMOTE, name : %s", group_name);
 
-       found_group_list = g_list_append(found_group_list, group);
+       mdg_group_info_clone(&cloned_group, group);
+
+       found_group_list = g_list_append(found_group_list, cloned_group);
 
        if (group_name != NULL)
                free(group_name);
@@ -907,6 +912,7 @@ bool _invited_device_found_cb(mdg_device_h device, void *user_data)
 {
        char *device_id = NULL;
        mdg_device_type_e device_type;
+       mdg_device_h cloned_device;
 
        mdg_device_info_get_device_id(device, &device_id);
        mdg_device_info_get_type(device, &device_type);
@@ -916,7 +922,9 @@ bool _invited_device_found_cb(mdg_device_h device, void *user_data)
        if (device_id)
                free(device_id);
 
-       found_invited_device_list = g_list_append(found_invited_device_list, device);
+       mdg_device_info_clone(&cloned_device, device);
+
+       found_invited_device_list = g_list_append(found_invited_device_list, cloned_device);
 
        return TRUE;
 }