From: Jeff Cody <jc...@redhat.com>

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 <jc...@redhat.com>
Acked-by: Michael Roth <mdr...@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefa...@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.1


Reply via email to