1 Star 0 Fork 71

ccxiaop/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rpc-Fix-memory-leak-of-fds.patch 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
From 88ddb9ae6bc020c5ce64f98a6a8e5823f48c885a Mon Sep 17 00:00:00 2001
From: Peng Liang <liangpeng10@huawei.com>
Date: Wed, 2 Mar 2022 17:22:05 +0800
Subject: [PATCH 108/108] rpc: Fix memory leak of fds
In virSystemdActivationClaimFDs, the memory of ent->fds has been stolen
and stored in fds, but fds is never freed, which causes a memory leak.
Fix it by declaring fds as g_autofree.
Reported-by: Jie Tang <tangjie18@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 8a1915c4d6c33669dcb390d0708cb6e5d651770d)
---
src/rpc/virnetserver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 242052754f..26f3a5ec31 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -683,7 +683,7 @@ virNetServerAddServiceActivation(virNetServerPtr srv,
size_t max_queued_clients,
size_t nrequests_client_max)
{
- int *fds;
+ g_autofree int *fds = NULL;
size_t nfds;
if (act == NULL)
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ccxiaop/libvirt.git
git@gitee.com:ccxiaop/libvirt.git
ccxiaop
libvirt
libvirt
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385