From b5105db0d1f719f5b0fd45d0fd02e9ca1b8b9b51 Mon Sep 17 00:00:00 2001 From: Radoslaw Cybulski Date: Tue, 6 Mar 2018 18:24:49 +0100 Subject: [PATCH] Fixes glib runtime warnings on freeing empty arrays Change-Id: Iba679a3cfbcdcdfd252c291d5f8bcf433c4d7198 --- test/at_spi2_tool.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/at_spi2_tool.c b/test/at_spi2_tool.c index 81bf021..c0daae4 100644 --- a/test/at_spi2_tool.c +++ b/test/at_spi2_tool.c @@ -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 *); -- 2.7.4