projects
/
platform
/
upstream
/
at-spi2-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[prevent][38682] Fix for resource leak
[platform/upstream/at-spi2-core.git]
/
test
/
at_spi2_tool.c
diff --git
a/test/at_spi2_tool.c
b/test/at_spi2_tool.c
index
81bf021
..
fb9739a
100644
(file)
--- 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);
{
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;
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_array_free(states, 0);
- g_
object_unref(
node_state_set);
+ g_
clear_object(&
node_state_set);
_truncate_string(state_string, length_limit);
_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,
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 ? "*" : "");
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);
free(box_size);
}
free(states);
- g_array_free(relations, TRUE);
+ if (relations)
+ g_array_free(relations, TRUE);
return g_strdup(result);
}
return g_strdup(result);
}
@@
-499,7
+503,8
@@
static void _print_relations_for_object(AtspiAccessible *node) {
printf("\n");
_print_horizontal_line_in_relations_table();
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 *);
}
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 (!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();
app_name_matched = true;
_print_module_legend();