https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8fde48b5d733c516eee24…
commit 8fde48b5d733c516eee249dad4df44ccdea2d40f
Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com>
AuthorDate: Mon May 25 23:52:35 2020 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon May 25 23:52:35 2020 +0200
[CSRSRV] CsrGetProcessLuid(): Check 1st NtQueryInformationToken() result too (#2857)
Detected by Cppcheck: redundantAssignment.
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
---
subsystems/win32/csrsrv/procsup.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/subsystems/win32/csrsrv/procsup.c b/subsystems/win32/csrsrv/procsup.c
index 30cde8a2fea..de9743cd6c2 100644
--- a/subsystems/win32/csrsrv/procsup.c
+++ b/subsystems/win32/csrsrv/procsup.c
@@ -873,6 +873,12 @@ CsrGetProcessLuid(IN HANDLE hProcess OPTIONAL,
NULL,
0,
&Length);
+ if (Status != STATUS_BUFFER_TOO_SMALL)
+ {
+ /* Close the token and fail */
+ NtClose(hToken);
+ return Status;
+ }
/* Allocate memory for the Token Info */
if (!(TokenStats = RtlAllocateHeap(CsrHeap, 0, Length)))