[PATCH] kvm tools: Fix leaked descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
---
 tools/kvm/builtin-list.c |    2 ++
 tools/kvm/kvm.c          |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/builtin-list.c b/tools/kvm/builtin-list.c
index dde3fb3..2d37ecb 100644
--- a/tools/kvm/builtin-list.c
+++ b/tools/kvm/builtin-list.c
@@ -27,6 +27,8 @@ static void print_guest(const char *name, int pid)
 
 	printf("%s (PID: %d)\n", name, pid);
 
+	close(fd);
+
 	return;
 
 cleanup:
diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
index a4a29b2..248eaf4 100644
--- a/tools/kvm/kvm.c
+++ b/tools/kvm/kvm.c
@@ -159,6 +159,8 @@ int kvm__get_pid_by_instance(const char *name)
 	if (pid < 0)
 		return -1;
 
+	close(fd);
+
 	return pid;
 }
 
@@ -183,6 +185,8 @@ int kvm__enumerate_instances(void (*callback)(const char *name, int pid))
 		}
 	}
 
+	closedir(dir);
+
 	return 0;
 }
 
-- 
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux