]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qga: fix file descriptor leak
authorPaolo Bonzini <pbonzini@redhat.com>
Sun, 15 Jul 2018 16:21:56 +0000 (18:21 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 16 Jul 2018 20:05:58 +0000 (15:05 -0500)
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

index c46767b0dd117cd21e55f65e1fd955d11493ed63..37e8a2d7918657f3d261fd5e1b0e9e966796069e 100644 (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;
     }