Skip to contentSkip to conversation

qemu-ga fixes for win32

GIT PULL New Michael Roth 2 participants 3 messages Jun 5, 2014

lore
Share & tools
lore
#0 lore raw

The following changes since commit e00fcfeab3d452cba3d0a08991a39ab15df66424:

Merge remote-tracking branch 'remotes/awilliam/tags/vfio-pci-for-qemu-20140602.0' into staging (2014-06-03 14:37:43 +0100)

are available in the git repository at:

git://github.com/mdroth/qemu.git qga-pull-2014-06-05

for you to fetch changes up to 374044f08fe18a18469b981812cd8695f5b3569c:

qga: Fix handle fd leak in acquire_privilege() (2014-06-03 15:07:59 -0500)

----------------------------------------------------------------
Gonglei (1):
qga: Fix handle fd leak in acquire_privilege()

 qga/commands-win32.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
#1 lore raw

PATCH 1/1 qga: Fix handle fd leak in acquire_privilege()

From: Gonglei <[email protected]>

token should be closed in all conditions.
So move CloseHandle(token) to "out" branch.

---
 qga/commands-win32.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
qga/commands-win32.c +4 -2
index d793dd0..e769396 100644
@@ -31,7 +31,7 @@
 
 static void acquire_privilege(const char *name, Error **errp)
 {
-    HANDLE token;
+    HANDLE token = NULL;
     TOKEN_PRIVILEGES priv;
     Error *local_err = NULL;
 
@@ -53,13 +53,15 @@ static void acquire_privilege(const char *name, Error **errp)
             goto out;
         }
 
-        CloseHandle(token);
     } else {
         error_set(&local_err, QERR_QGA_COMMAND_FAILED,
                   "failed to open privilege token");
     }
 
 out:
+    if (token) {
+        CloseHandle(token);
+    }
     if (local_err) {
         error_propagate(errp, local_err);
     }
Signature · 1 line
1.9.1
#2 lore raw
In reply to Michael Roth
Quoted 4 lines · Michael Roth

The following changes since commit e00fcfeab3d452cba3d0a08991a39ab15df66424:

Merge remote-tracking branch 'remotes/awilliam/tags/vfio-pci-for-qemu-20140602.0' into staging (2014-06-03 14:37:43 +0100)

Quoted 8 lines

are available in the git repository at:

git://github.com/mdroth/qemu.git qga-pull-2014-06-05

for you to fetch changes up to 374044f08fe18a18469b981812cd8695f5b3569c:

qga: Fix handle fd leak in acquire_privilege() (2014-06-03 15:07:59 -0500)

Applied, thanks.

-- PMM