From 20f1db2467d45a286b9166ce2098cd89120f0dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Thu, 3 Mar 2022 14:02:28 +0100 Subject: [PATCH] remote: dispatch: free and close infiles too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ján Tomko Reviewed-by: Peter Krempa --- src/remote/remote_daemon_dispatch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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]);