From c3e4247e30df29c622adc1a6106e3fefc445d48c Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Thu, 11 May 2017 18:45:37 -0400 Subject: [PATCH] Close token handle in GetProcessTokenGroups() Signed-off-by: Selva Nair --- access.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/access.c b/access.c index bd0a37b..e77ef67 100644 --- a/access.c +++ b/access.c @@ -324,7 +324,7 @@ GetProcessTokenGroups(void) if (!groups) { PrintDebug(L"GetProcessTokenGroups: error = %lu", GetLastError()); - return NULL; + goto out; } if (!GetTokenInformation(token, TokenGroups, groups, buf_size, &buf_size)) { @@ -332,6 +332,9 @@ GetProcessTokenGroups(void) free (groups); groups = NULL; } + +out: + CloseHandle(token); return groups; }