From: Paolo Bonzini Date: Sun, 15 Jul 2018 16:21:56 +0000 (+0200) Subject: qga: fix file descriptor leak X-Git-Tag: qemu-xen-4.12.0-rc1~66^2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d9c745c1768727aadd77e352c85114bc61e67bd4;p=qemu-xen.git qga: fix file descriptor leak The file descriptor for /sys/power/state was never closed. Reported by Coverity. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Michael Roth --- 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; }