From 8b4a7fbb80011140bf37c492ea1ddfe1c2e53986 Mon Sep 17 00:00:00 2001 Message-Id: <8b4a7fbb80011140bf37c492ea1ddfe1c2e53986.1342518105.git.minovotn@redhat.com> In-Reply-To: <27a73856ecc481c66c7afac8171f753887f32e31.1342518105.git.minovotn@redhat.com> References: <27a73856ecc481c66c7afac8171f753887f32e31.1342518105.git.minovotn@redhat.com> From: Luiz Capitulino Date: Tue, 5 Jun 2012 14:58:25 +0200 Subject: [PATCH 16/41] qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write() RH-Author: Luiz Capitulino Message-id: <1338908331-15633-11-git-send-email-lcapitulino@redhat.com> Patchwork-id: 39907 O-Subject: [PATCH RHEL6.4 qemu-kvm 10/36] qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write() Bugzilla: 827612 RH-Acked-by: Paolo Bonzini RH-Acked-by: Juan Quintela RH-Acked-by: Jeffrey Cody From: Jeff Cody 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 (cherry picked from commit b71706d122838d9656e1a6dae80e22401babdf37) Signed-off-by: Luiz Capitulino --- qga/channel-win32.c | 4 ++++ 1 file changed, 4 insertions(+) Signed-off-by: Michal Novotny --- qga/channel-win32.c | 4 ++++ 1 file changed, 4 insertions(+) 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.10.4