aboutsummaryrefslogtreecommitdiff
path: root/qga/commands-posix.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-07-15 18:21:56 +0200
committerMichael Roth <mdroth@linux.vnet.ibm.com>2018-07-16 15:05:58 -0500
commitd9c745c1768727aadd77e352c85114bc61e67bd4 (patch)
tree508ff8b7414b32864b968058ea60a1748962da5b /qga/commands-posix.c
parentbb23a7362a7942739f080990a53e44afc319e36c (diff)
qga: fix file descriptor leak
The file descriptor for /sys/power/state was never closed. Reported by Coverity. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga/commands-posix.c')
-rw-r--r--qga/commands-posix.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index c46767b0dd..37e8a2d791 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -1652,6 +1652,7 @@ static bool linux_sys_state_supports_mode(SuspendMode mode, Error **errp)
}
ret = read(fd, buf, sizeof(buf) - 1);
+ close(fd);
if (ret <= 0) {
return false;
}