From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8FNg-0006Sl-0i for qemu-devel@nongnu.org; Thu, 15 Mar 2012 14:26:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8FNZ-0005UA-Uf for qemu-devel@nongnu.org; Thu, 15 Mar 2012 14:26:31 -0400 From: Jeff Cody Date: Thu, 15 Mar 2012 14:26:18 -0400 Message-Id: Subject: [Qemu-devel] [PATCH] qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, pbonzini@redhat.com, mdroth@linux.vnet.ibm.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 --- 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