From: Peng Liang Date: Wed, 2 Mar 2022 09:22:05 +0000 (+0800) Subject: rpc: Fix memory leak of fds X-Git-Tag: v8.2.0-rc1~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a1915c4d6c33669dcb390d0708cb6e5d651770d;p=thirdparty%2Flibvirt.git 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 Signed-off-by: Peng Liang Reviewed-by: Michal Privoznik --- diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index ad581a36dd..d9430a2cfa 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -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)