qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write()
@ 2012-03-15 18:26 Jeff Cody
  2012-03-15 18:39 ` Michael Roth
  2012-03-19 11:00 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Jeff Cody @ 2012-03-15 18:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, pbonzini, mdroth

In the function ga_channel_write(), the handle ov.hEvent is created
by the call to CreateEvent(). However, the handle is not closed
prior to the function return.

This patch closes the handle before the return of the function.

Kudos to Paolo Bonzini for spotting this bug.

Signed-off-by: Jeff Cody <jcody@redhat.com>
---
 qga/channel-win32.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/qga/channel-win32.c b/qga/channel-win32.c
index 190251b..16bf44a 100644
--- a/qga/channel-win32.c
+++ b/qga/channel-win32.c
@@ -259,6 +259,10 @@ static GIOStatus ga_channel_write(GAChannel *c, const char *buf, size_t size,
         *count = written;
     }
 
+    if (ov.hEvent) {
+        CloseHandle(ov.hEvent);
+        ov.hEvent = NULL;
+    }
     return status;
 }
 
-- 
1.7.9.rc2.1.g69204

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

* Re: [Qemu-devel] [PATCH] qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write()
  2012-03-15 18:26 [Qemu-devel] [PATCH] qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write() Jeff Cody
@ 2012-03-15 18:39 ` Michael Roth
  2012-03-19 11:00 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Roth @ 2012-03-15 18:39 UTC (permalink / raw)
  To: Jeff Cody; +Cc: qemu-trivial, pbonzini, qemu-devel

On Thu, Mar 15, 2012 at 02:26:18PM -0400, Jeff Cody wrote:
> In the function ga_channel_write(), the handle ov.hEvent is created
> by the call to CreateEvent(). However, the handle is not closed
> prior to the function return.
> 
> This patch closes the handle before the return of the function.
> 
> Kudos to Paolo Bonzini for spotting this bug.
> 
> Signed-off-by: Jeff Cody <jcody@redhat.com>

Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com>

> ---
>  qga/channel-win32.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/qga/channel-win32.c b/qga/channel-win32.c
> index 190251b..16bf44a 100644
> --- a/qga/channel-win32.c
> +++ b/qga/channel-win32.c
> @@ -259,6 +259,10 @@ static GIOStatus ga_channel_write(GAChannel *c, const char *buf, size_t size,
>          *count = written;
>      }
> 
> +    if (ov.hEvent) {
> +        CloseHandle(ov.hEvent);
> +        ov.hEvent = NULL;
> +    }
>      return status;
>  }
> 
> -- 
> 1.7.9.rc2.1.g69204
> 

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

* Re: [Qemu-devel] [PATCH] qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write()
  2012-03-15 18:26 [Qemu-devel] [PATCH] qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write() Jeff Cody
  2012-03-15 18:39 ` Michael Roth
@ 2012-03-19 11:00 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2012-03-19 11:00 UTC (permalink / raw)
  To: Jeff Cody; +Cc: qemu-trivial, pbonzini, qemu-devel, mdroth

On Thu, Mar 15, 2012 at 02:26:18PM -0400, Jeff Cody wrote:
> In the function ga_channel_write(), the handle ov.hEvent is created
> by the call to CreateEvent(). However, the handle is not closed
> prior to the function return.
> 
> This patch closes the handle before the return of the function.
> 
> Kudos to Paolo Bonzini for spotting this bug.
> 
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
>  qga/channel-win32.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

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

end of thread, other threads:[~2012-03-19 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15 18:26 [Qemu-devel] [PATCH] qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write() Jeff Cody
2012-03-15 18:39 ` Michael Roth
2012-03-19 11:00 ` Stefan Hajnoczi

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