Skip to contentSkip to conversation

kvm tools: Fix leaked descriptors

PATCH New Sasha Levin 1 participant 1 message Jul 10, 2011 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm tools: Fix leaked descriptors

---
 tools/kvm/builtin-list.c |    2 ++
 tools/kvm/kvm.c          |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)
tools/kvm/builtin-list.c +2 -0
index dde3fb3..2d37ecb 100644
@@ -27,6 +27,8 @@ static void print_guest(const char *name, int pid)
 
 	printf("%s (PID: %d)\n", name, pid);
 
+	close(fd);
+
 	return;
 
 cleanup:
tools/kvm/kvm.c +4 -0
index a4a29b2..248eaf4 100644
@@ -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;
 }
 
Signature · 1 line
1.7.6