qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-3.0] qga: fix file descriptor leak
@ 2018-07-15 16:21 Paolo Bonzini
  2018-07-15 22:22 ` Philippe Mathieu-Daudé
  2018-07-16 21:37 ` Michael Roth
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2018-07-15 16:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Roth

The file descriptor for /sys/power/state was never closed.  Reported
by Coverity.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qga/commands-posix.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 233f78a406..4160aceaed 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -1651,6 +1651,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.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-3.0] qga: fix file descriptor leak
  2018-07-15 16:21 [Qemu-devel] [PATCH for-3.0] qga: fix file descriptor leak Paolo Bonzini
@ 2018-07-15 22:22 ` Philippe Mathieu-Daudé
  2018-07-16 21:37 ` Michael Roth
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-07-15 22:22 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Michael Roth

On 07/15/2018 01:21 PM, Paolo Bonzini wrote:
> 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>

> ---
>  qga/commands-posix.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index 233f78a406..4160aceaed 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -1651,6 +1651,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;
>      }
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-3.0] qga: fix file descriptor leak
  2018-07-15 16:21 [Qemu-devel] [PATCH for-3.0] qga: fix file descriptor leak Paolo Bonzini
  2018-07-15 22:22 ` Philippe Mathieu-Daudé
@ 2018-07-16 21:37 ` Michael Roth
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Roth @ 2018-07-16 21:37 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

Quoting Paolo Bonzini (2018-07-15 11:21:56)
> The file descriptor for /sys/power/state was never closed.  Reported
> by Coverity.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Thanks, applied to qga tree:
  https://github.com/mdroth/qemu/commits/qga

> ---
>  qga/commands-posix.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index 233f78a406..4160aceaed 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -1651,6 +1651,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.17.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-16 21:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-15 16:21 [Qemu-devel] [PATCH for-3.0] qga: fix file descriptor leak Paolo Bonzini
2018-07-15 22:22 ` Philippe Mathieu-Daudé
2018-07-16 21:37 ` Michael Roth

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).