From patchwork Thu Mar 15 18:26:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 147055 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AB59CB6F13 for ; Fri, 16 Mar 2012 05:26:43 +1100 (EST) Received: from localhost ([::1]:47894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8FNn-0006Ui-P9 for incoming@patchwork.ozlabs.org; Thu, 15 Mar 2012 14:26:39 -0400 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 Received: from mx1.redhat.com ([209.132.183.28]:52553) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8FNZ-0005Tv-Mh; Thu, 15 Mar 2012 14:26:25 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2FIQLmC015692 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 15 Mar 2012 14:26:21 -0400 Received: from localhost (ovpn-112-61.phx2.redhat.com [10.3.112.61]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q2FIQJ4u014816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 15 Mar 2012 14:26:21 -0400 From: Jeff Cody To: qemu-devel@nongnu.org Date: Thu, 15 Mar 2012 14:26:18 -0400 Message-Id: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: qemu-trivial@nongnu.org, pbonzini@redhat.com, mdroth@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH] qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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; }