1 Star 0 Fork 71

yoo/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
client-fix-memory-leak-in-client-msg.patch 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
yezengruan 提交于 2022-12-06 15:38 . libvirt update to version 6.2.0-47
From ea9860d9f89252f0890dae01c6b92af2a82227f4 Mon Sep 17 00:00:00 2001
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
Date: Tue, 29 Nov 2022 08:19:29 +0000
Subject: [PATCH 02/24] client: fix memory leak in client msg When closing
client->waitDispatch in virNetClientIOEventLoopRemoveAll or
virNetClientIOEventLoopRemoveDone, VIR_FREE() is called to free call->msg
directly, resulting in leak of the memory call->msg->buffer points to. Use
virNetMessageFree(call->msg) instead of VIR_FREE(call->msg).
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Hao Wang <wanghao232@huawei.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: tangbin <tangbin_yewu@cmss.chinamobile.com>
(cherry-pick from 0011ec3191a5bffff14fc2c53fbdf457a805cfb1)
---
src/rpc/virnetclient.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 1c5bef86a1..70ace5d0e8 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1519,7 +1519,7 @@ static bool virNetClientIOEventLoopRemoveDone(virNetClientCallPtr call,
if (call->expectReply)
VIR_WARN("Got a call expecting a reply but without a waiting thread");
virCondDestroy(&call->cond);
- VIR_FREE(call->msg);
+ virNetMessageFree(call->msg);
VIR_FREE(call);
}
@@ -1546,7 +1546,7 @@ virNetClientIOEventLoopRemoveAll(virNetClientCallPtr call,
VIR_DEBUG("Removing call %p", call);
virCondDestroy(&call->cond);
- VIR_FREE(call->msg);
+ virNetMessageFree(call->msg);
VIR_FREE(call);
return true;
}
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mdLUbG/libvirt.git
git@gitee.com:mdLUbG/libvirt.git
mdLUbG
libvirt
libvirt
master

搜索帮助