aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-06-05 22:40:44 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-06-05 22:40:44 +0100
commit4e627aeef8353a2af151cd2c82aa5eedf79e5534 (patch)
tree4e6dba6320100a80290815723e70190374f47872
parent26edf8cc08e2ec15d9e65bb0dd4fbac22edd730b (diff)
parent374044f08fe18a18469b981812cd8695f5b3569c (diff)
Merge remote-tracking branch 'remotes/mdroth/qga-pull-2014-06-05' into staging
* remotes/mdroth/qga-pull-2014-06-05: qga: Fix handle fd leak in acquire_privilege() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--qga/commands-win32.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index d793dd0c85..e76939651a 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -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);
}