test: fixed accumulated group resource when we calld 'find group' more
authorsaerome.kim <saerome.kim@samsung.com>
Mon, 30 Apr 2018 10:55:41 +0000 (19:55 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Tue, 3 Jul 2018 01:43:25 +0000 (10:43 +0900)
than one.

Signed-off-by: saerome.kim <saerome.kim@samsung.com>
capi/test/mdg-manager.c

index 4e4e0c4..281d7ff 100644 (file)
@@ -774,6 +774,11 @@ static int run_group_find(MManager *mm, struct menu_data *menu)
        if (strlen(timeout))
                duration = (unsigned short)strtol(timeout, NULL, 10);
 
+       if (found_group_list) {
+               g_list_free_full(found_group_list, _destroy_mdg_group_info);
+               found_group_list = NULL;
+       }
+
        ret = mdg_group_find(handle, duration, _group_found_cb, _group_finish_cb, NULL);
        if (MDG_ERROR_NONE != ret) {
                msgr("Failed to Find Group: [%s(0x%X)]", mdg_error_to_string(ret), ret);
@@ -781,11 +786,6 @@ static int run_group_find(MManager *mm, struct menu_data *menu)
        }
        msg(" - mdg_group_find() ret: [0x%X] [%s]", ret, mdg_error_to_string(ret));
 
-       if (found_group_list) {
-               g_list_free_full(found_group_list, _destroy_mdg_group_info);
-               found_group_list = NULL;
-       }
-
        return RET_SUCCESS;
 }