summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Cody <jcody@redhat.com>2012-03-15 14:26:18 -0400
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2012-03-19 11:31:04 +0000
commitb71706d122838d9656e1a6dae80e22401babdf37 (patch)
tree1b7944dd0a3f62f3f14a6ca362414623d7ddb0d3
parent0c1f781b7c8ddd79ca15c20b59afa2be69d18295 (diff)
downloadqemu-b71706d122838d9656e1a6dae80e22401babdf37.tar.gz
qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write()
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> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
-rw-r--r--qga/channel-win32.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/qga/channel-win32.c b/qga/channel-win32.c
index 190251bb57..16bf44a376 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;
}