diff mbox series

[PULL,for-3.0,2/2] qga: fix file descriptor leak

Message ID 20180716214450.17758-3-mdroth@linux.vnet.ibm.com
State New
Headers show
Series [PULL,for-3.0,1/2] qga: fix 'driver' leak in guest-get-fsinfo | expand

Commit Message

Michael Roth July 16, 2018, 9:44 p.m. UTC
From: Paolo Bonzini <pbonzini@redhat.com>

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>
---
 qga/commands-posix.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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