1 Star 0 Fork 14

yanshuai/open-isns

forked from src-openEuler/open-isns 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0004-isnsadm-free-qry-in-error-paths.patch 1.94 KB
一键复制 编辑 原始数据 按行查看 历史
yanshuai 提交于 2024-09-26 15:19 +08:00 . fix mem leaks
From c542da377c3dc070e081c1d26e74531d75f236cc Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 26 Mar 2024 12:55:45 -0700
Subject: [PATCH] isnsadm: free qry in error paths
There are multiple error handling paths in query_objects and
query_entity_id that do not free the qry allocation.
I realize that isnsadm is a short lived process, and memory leaks are
not an issue, but this will keep static checkers quiet.
Signed-off-by: Chris Leech <cleech@redhat.com>
---
isnsadm.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/isnsadm.c b/isnsadm.c
index 0710877..c4d2264 100644
--- a/isnsadm.c
+++ b/isnsadm.c
@@ -619,20 +619,20 @@ query_objects(isns_client_t *clnt, int argc, char **argv)
status = isns_client_call(clnt, &qry);
if (status != ISNS_SUCCESS) {
isns_error("Query failed: %s\n", isns_strerror(status));
- return status;
+ goto out;
}
status = isns_query_response_get_objects(qry, &objects);
if (status) {
isns_error("Unable to extract object list from query response: %s\n",
isns_strerror(status), status);
- return status;
+ goto out;
}
isns_object_list_print(&objects, isns_print_stdout);
isns_object_list_destroy(&objects);
+out:
isns_simple_free(qry);
-
return status;
}
@@ -664,14 +664,14 @@ query_entity_id(isns_client_t *clnt, int argc, char **argv)
status = isns_client_call(clnt, &qry);
if (status != ISNS_SUCCESS) {
isns_error("Query failed: %s\n", isns_strerror(status));
- return status;
+ goto out;
}
status = isns_query_response_get_objects(qry, &objects);
if (status) {
isns_error("Unable to extract object list from query response: %s\n",
isns_strerror(status), status);
- return status;
+ goto out;
}
status = ISNS_NO_SUCH_ENTRY;
@@ -689,8 +689,8 @@ query_entity_id(isns_client_t *clnt, int argc, char **argv)
}
isns_object_list_destroy(&objects);
+out:
isns_simple_free(qry);
-
return status;
}
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yanyan11222/open-isns.git
git@gitee.com:yanyan11222/open-isns.git
yanyan11222
open-isns
open-isns
master

搜索帮助