From: Jeff Cody Date: Thu, 15 Mar 2012 18:26:18 +0000 (-0400) Subject: qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b71706d122838d9656e1a6dae80e22401babdf37;p=qemu.git 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 Acked-by: Michael Roth Signed-off-by: Stefan Hajnoczi --- 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; }