at-spi2-atk/backport-also-fix-ref-leak-in-try_get_root.patch
kerongw b829fc4cd4 fix memory leak in test
Signed-off-by: kerongw <wangkerong@h-partners.com>
(cherry picked from commit 9d61eae969b2b3c1397194c13ca67852e30009bd)
2022-10-25 09:55:36 +08:00

34 lines
1.0 KiB
Diff

From 65b22d16e5b81544672c8acf01f0a0388e1192a5 Mon Sep 17 00:00:00 2001
From: Mike Gorse <mgorse@suse.com>
Date: Wed, 16 Dec 2020 08:52:30 -0600
Subject: [PATCH] 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 23735230..366725c4 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;
--
GitLab