3a9410
From 0f6009e5a8ca63388772597f3e42c71b50635a02 Mon Sep 17 00:00:00 2001
3a9410
Message-Id: <0f6009e5a8ca63388772597f3e42c71b50635a02@dist-git>
3a9410
From: Peng Liang <liangpeng10@huawei.com>
3a9410
Date: Wed, 2 Mar 2022 17:22:05 +0800
3a9410
Subject: [PATCH] rpc: Fix memory leak of fds
3a9410
3a9410
In virSystemdActivationClaimFDs, the memory of ent->fds has been stolen
3a9410
and stored in fds, but fds is never freed, which causes a memory leak.
3a9410
Fix it by declaring fds as g_autofree.
3a9410
3a9410
Reported-by: Jie Tang <tangjie18@huawei.com>
3a9410
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
3a9410
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3a9410
(cherry picked from commit 8a1915c4d6c33669dcb390d0708cb6e5d651770d)
3a9410
https://bugzilla.redhat.com/show_bug.cgi?id=2165428
3a9410
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
3a9410
---
3a9410
 src/rpc/virnetserver.c | 2 +-
3a9410
 1 file changed, 1 insertion(+), 1 deletion(-)
3a9410
3a9410
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
3a9410
index ad581a36dd..d9430a2cfa 100644
3a9410
--- a/src/rpc/virnetserver.c
3a9410
+++ b/src/rpc/virnetserver.c
3a9410
@@ -655,7 +655,7 @@ virNetServerAddServiceActivation(virNetServer *srv,
3a9410
                                  size_t max_queued_clients,
3a9410
                                  size_t nrequests_client_max)
3a9410
 {
3a9410
-    int *fds;
3a9410
+    g_autofree int *fds = NULL;
3a9410
     size_t nfds;
3a9410
 
3a9410
     if (act == NULL)
3a9410
-- 
3a9410
2.39.1
3a9410