[at-spi2-atk] tests: also fix ref leak in try_get_root()



commit 65b22d16e5b81544672c8acf01f0a0388e1192a5
Author: Mike Gorse <mgorse suse com>
Date:   Wed Dec 16 08:52:30 2020 -0600

    tests: also fix ref leak in try_get_root()

 tests/atk_test_util.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/tests/atk_test_util.c b/tests/atk_test_util.c
index 2373523..366725c 100644
--- a/tests/atk_test_util.c
+++ b/tests/atk_test_util.c
@@ -62,13 +62,16 @@ static AtspiAccessible *try_get_root_obj (AtspiAccessible *obj)
 
   for (i = 0; i < child_count; i++) {
     AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, i, NULL);
-    if (child && name = atspi_accessible_get_name (child, NULL)) {
+    if (!child)
+      continue;
+    if ((name = atspi_accessible_get_name (child, NULL)) != NULL) {
       if (!strcmp (name, "root_object")) {
         g_free(name);
         return child;
       }
       g_free(name);
     }
+    g_object_unref (child);
   }
 
   return NULL;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]