X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=test%2Fat_spi2_tool.c;h=fb9739a0a1145f875cd6f778bd52329ea1a012c9;hb=d3c1fc8c5aca4fca78c0c04580c9e4532eba8ff2;hp=81bf021414734a2dadd9898a7c576bdfe51f9e37;hpb=4451c5d514924b3d83af9736fb9ec1ee9e3854cf;p=platform%2Fupstream%2Fat-spi2-core.git diff --git a/test/at_spi2_tool.c b/test/at_spi2_tool.c index 81bf021..fb9739a 100644 --- a/test/at_spi2_tool.c +++ b/test/at_spi2_tool.c @@ -241,7 +241,10 @@ static char *_get_states(AtspiAccessible *node, int length_limit) { AtspiStateSet *node_state_set = atspi_accessible_get_state_set(node); GArray *states = atspi_state_set_get_states(node_state_set); - if (!states) return NULL; + if (!states) { + g_clear_object(&node_state_set); + return NULL; + } g_array_sort(states, _int_sort_function); AtspiStateType state_type; @@ -259,7 +262,7 @@ static char *_get_states(AtspiAccessible *node, int length_limit) } g_array_free(states, 0); - g_object_unref(node_state_set); + g_clear_object(&node_state_set); _truncate_string(state_string, length_limit); @@ -320,10 +323,10 @@ static char *_get_info(AtspiAccessible *node, int length_limit, bool *attributes unique_id, (uintptr_t)eo_ptr, node_role_name, attributes, - box_size->x, - box_size->y, - box_size->width, - box_size->height, + box_size ? box_size->x : "nil", + box_size ? box_size->y : "nil", + box_size ? box_size->width : "nil", + box_size ? box_size->height : "nil", node_name, states, current_node_has_relations ? "*" : ""); @@ -345,7 +348,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 +503,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 *); @@ -628,7 +633,7 @@ static void _atspi_tree_traverse(const char *app_name, bool dump, bool check, bo if (!dump && !check) printf("%s\n", name); - if ((check || dump) && name && !strcmp(name, app_name)) { + if ((check || dump) && name && app_name && !strcmp(name, app_name)) { app_name_matched = true; _print_module_legend();