[libvirt PATCH 2/2] remote: dispatch: free and close infiles too

Ján Tomko jtomko at redhat.com
Thu Mar 3 13:08:51 UTC 2022


Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 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]);
 
-- 
2.34.1




More information about the libvir-list mailing list