qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PULL for-3.0 2/2] qga: fix file descriptor leak
Date: Mon, 16 Jul 2018 16:44:50 -0500	[thread overview]
Message-ID: <20180716214450.17758-3-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180716214450.17758-1-mdroth@linux.vnet.ibm.com>

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

  parent reply	other threads:[~2018-07-16 21:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 21:44 [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze Michael Roth
2018-07-16 21:44 ` [Qemu-devel] [PULL for-3.0 1/2] qga: fix 'driver' leak in guest-get-fsinfo Michael Roth
2018-07-16 21:44 ` Michael Roth [this message]
2018-07-17  9:54 ` [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180716214450.17758-3-mdroth@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).