From: Ján Tomko Date: Thu, 3 Mar 2022 13:02:28 +0000 (+0100) Subject: remote: dispatch: free and close infiles too X-Git-Tag: v8.2.0-rc1~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20f1db2467d45a286b9166ce2098cd89120f0dcd;p=thirdparty%2Flibvirt.git remote: dispatch: free and close infiles too Signed-off-by: Ján Tomko Reviewed-by: Peter Krempa --- diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c index 510856024c..e468bbf261 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -4693,7 +4693,7 @@ qemuDispatchDomainMonitorCommandWithFiles(virNetServer *server G_GNUC_UNUSED, qemu_domain_monitor_command_with_files_ret *ret) { virDomainPtr dom = NULL; - int *infiles = NULL; + g_autofree int *infiles = NULL; unsigned int ninfiles = 0; int *outfiles = NULL; unsigned int noutfiles = 0; @@ -4736,6 +4736,9 @@ qemuDispatchDomainMonitorCommandWithFiles(virNetServer *server G_GNUC_UNUSED, rv = 0; cleanup: + for (i = 0; i < ninfiles; i++) + VIR_FORCE_CLOSE(infiles[i]); + for (i = 0; i < noutfiles; i++) VIR_FORCE_CLOSE(outfiles[i]);