kvm tools: Fix leaked descriptors

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Sasha Levin
2011-07-10 15:41:55 +03:00
committed by Will Deacon
parent b2ebe61b25
commit 1a0ef25162
2 changed files with 6 additions and 0 deletions
+2
View File
@@ -27,6 +27,8 @@ static void print_guest(const char *name, int pid)
printf("%s (PID: %d)\n", name, pid);
close(fd);
return;
cleanup:
+4
View File
@@ -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;
}