]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write()
authorJeff Cody <jcody@redhat.com>
Thu, 15 Mar 2012 18:26:18 +0000 (14:26 -0400)
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Mon, 19 Mar 2012 11:31:04 +0000 (11:31 +0000)
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>
qga/channel-win32.c

index 190251bb57ac38ddc607fc3160b2e24c644b2e65..16bf44a376bd5ce096d6e96d7eedd73f09b939d2 100644 (file)
@@ -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;
 }