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>
This commit is contained in:
Paolo Bonzini 2018-07-15 18:21:56 +02:00 committed by Michael Roth
parent bb23a7362a
commit d9c745c176
1 changed files with 1 additions and 0 deletions

View File

@ -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;
}