computing-offload/generic_vdpa/libvirt/client-fix-memory-leak-in-client-msg.patch
jiangdongxu 79c4324644 add generic_vdpa basecode
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
2024-09-19 17:19:46 +08:00

48 lines
1.7 KiB
Diff

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