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>
This commit is contained in:
Peng Liang 2022-03-02 17:22:05 +08:00 committed by Michal Privoznik
parent cac9608c17
commit 8a1915c4d6

View File

@ -655,7 +655,7 @@ virNetServerAddServiceActivation(virNetServer *srv,
size_t max_queued_clients,
size_t nrequests_client_max)
{
int *fds;
g_autofree int *fds = NULL;
size_t nfds;
if (act == NULL)