Fixes glib runtime warnings on freeing empty arrays 98/171698/3
authorRadoslaw Cybulski <r.cybulski@partner.samsung.com>
Tue, 6 Mar 2018 17:24:49 +0000 (18:24 +0100)
committerRadoslaw Cybulski <r.cybulski@partner.samsung.com>
Wed, 7 Mar 2018 12:46:13 +0000 (13:46 +0100)
Change-Id: Iba679a3cfbcdcdfd252c291d5f8bcf433c4d7198

test/at_spi2_tool.c

index 81bf021..c0daae4 100644 (file)
@@ -258,7 +258,8 @@ static char *_get_states(AtspiAccessible *node, int length_limit)
                _combine_strings(&state_string, node_state_str);
        }
 
-       g_array_free(states, 0);
+       if (states)
+               g_array_free(states, 0);
        g_object_unref(node_state_set);
 
        _truncate_string(state_string, length_limit);
@@ -345,7 +346,8 @@ static char *_get_info(AtspiAccessible *node, int length_limit, bool *attributes
                free(box_size);
        }
        free(states);
-       g_array_free(relations, TRUE);
+       if (relations)
+               g_array_free(relations, TRUE);
 
        return g_strdup(result);
 }
@@ -499,7 +501,8 @@ static void _print_relations_for_object(AtspiAccessible *node) {
 
        printf("\n");
        _print_horizontal_line_in_relations_table();
-       g_array_free(relations, TRUE);
+       if (relations)
+               g_array_free(relations, TRUE);
 }
 
 typedef void (*print_information_about_object_function)(AtspiAccessible *);