13 Star 0 Fork 11

src-openEuler/at-spi2-atk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-fix-test-memory-leak.patch 1.42 KB
一键复制 编辑 原始数据 按行查看 历史
kerongw 提交于 2022-10-22 07:58 . fix memory leak in test
From 87c898bcbde8452a349b0d472b850a0d7277c446 Mon Sep 17 00:00:00 2001
From: Shinwoo Kim <cinoo.kim@samsung.com>
Date: Tue, 15 Dec 2020 11:50:49 +0900
Subject: [PATCH] tests: fix memory leak
The return value of atspi_accessible_get_name should be released after using it.
---
tests/atk_test_util.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tests/atk_test_util.c b/tests/atk_test_util.c
index 3e3c08a2..23735230 100644
--- a/tests/atk_test_util.c
+++ b/tests/atk_test_util.c
@@ -52,6 +52,7 @@ run_app (const char *file_name)
static AtspiAccessible *try_get_root_obj (AtspiAccessible *obj)
{
+ gchar *name;
int i;
gint child_count = atspi_accessible_get_child_count (obj, NULL);
@@ -59,10 +60,15 @@ static AtspiAccessible *try_get_root_obj (AtspiAccessible *obj)
return NULL;
}
- for (i=0; i<child_count; i++) {
- AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,i, NULL);
- if (child && !strcmp (atspi_accessible_get_name (child, NULL), "root_object"))
- return child;
+ 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 (!strcmp (name, "root_object")) {
+ g_free(name);
+ return child;
+ }
+ g_free(name);
+ }
}
return NULL;
--
GitLab
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/at-spi2-atk.git
git@gitee.com:src-openeuler/at-spi2-atk.git
src-openeuler
at-spi2-atk
at-spi2-atk
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385