[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 069/108] qga: Fix handle fd leak in acquire_privile
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 069/108] qga: Fix handle fd leak in acquire_privilege() |
Date: |
Wed, 6 Aug 2014 15:39:19 -0500 |
From: Gonglei <address@hidden>
token should be closed in all conditions.
So move CloseHandle(token) to "out" branch.
Signed-off-by: Wang Rui <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
(cherry picked from commit 374044f08fe18a18469b981812cd8695f5b3569c)
Signed-off-by: Michael Roth <address@hidden>
---
qga/commands-win32.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 0ee07b6..26ef172 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -31,7 +31,7 @@
static void acquire_privilege(const char *name, Error **err)
{
- HANDLE token;
+ HANDLE token = NULL;
TOKEN_PRIVILEGES priv;
Error *local_err = NULL;
@@ -57,13 +57,15 @@ static void acquire_privilege(const char *name, Error **err)
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(err, local_err);
}
--
1.9.1
- [Qemu-stable] [PATCH 058/108] block/qapi: Plug memory leak in dump_qobject() case QTYPE_QERROR, (continued)
- [Qemu-stable] [PATCH 058/108] block/qapi: Plug memory leak in dump_qobject() case QTYPE_QERROR, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 063/108] qcow2: Plug memory leak on qcow2_invalidate_cache() error paths, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 061/108] qemu-io: Plug memory leak in open command, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 065/108] tcg-i386: Fix win64 qemu store, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 064/108] linux-user: Don't overrun guest buffer in sched_getaffinity, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 066/108] target-arm: Fix errors in writes to generic timer control registers, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 067/108] s390x/css: handle emw correctly for tsch, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 034/108] qdev: Fix crash by validating the object type, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 070/108] migration: remove duplicate code, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 068/108] aio: fix qemu_bh_schedule() bh->ctx race condition, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 069/108] qga: Fix handle fd leak in acquire_privilege(),
Michael Roth <=
- [Qemu-stable] [PATCH 071/108] arch_init: Be sure of only one exit entry with DPRINTF() for ram_load(), Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 073/108] rdma: bug fixes, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 072/108] migration: catch unknown flags in ram_load, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 075/108] qdev: reorganize error reporting in bus_set_realized, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 076/108] qdev: recursively unrealize devices when unrealizing bus, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 077/108] scsi-disk: fix bug in scsi_block_new_request() introduced by commit 137745c, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 078/108] vhost: fix resource leak in error handling, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 080/108] usb: Fix usb-bt-dongle initialization., Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 079/108] virtio-scsi: define dummy handle_output for vhost-scsi vqs, Michael Roth, 2014/08/06
- [Qemu-stable] [PATCH 083/108] coroutine-win32.c: Add noinline attribute to work around gcc bug, Michael Roth, 2014/08/06