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>
This commit is contained in:
Peter Maydell 2014-06-05 22:40:44 +01:00
commit 4e627aeef8
1 changed files with 4 additions and 2 deletions

View File

@ -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);
}