Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(982)

Unified Diff: sandbox/win/src/restricted_token_utils.cc

Issue 1337223002: Fixes to possible GetLastError bugs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sandbox/win/src/restricted_token_utils.cc
diff --git a/sandbox/win/src/restricted_token_utils.cc b/sandbox/win/src/restricted_token_utils.cc
index 7f70e88e8fd6e2ffa13b3547a4de2305b2d39ac5..4a3d05c639bcd5acbfff79ce2a96df946fc56ce7 100644
--- a/sandbox/win/src/restricted_token_utils.cc
+++ b/sandbox/win/src/restricted_token_utils.cc
@@ -218,9 +218,10 @@ DWORD SetTokenIntegrityLevel(HANDLE token, IntegrityLevel integrity_level) {
DWORD size = sizeof(TOKEN_MANDATORY_LABEL) + ::GetLengthSid(integrity_sid);
BOOL result = ::SetTokenInformation(token, TokenIntegrityLevel, &label,
size);
+ auto last_error = ::GetLastError();
brucedawson 2015/09/12 00:33:55 Latch LastError before LocalFree. Probably doesn't
::LocalFree(integrity_sid);
- return result ? ERROR_SUCCESS : ::GetLastError();
+ return result ? ERROR_SUCCESS : last_error;
}
DWORD SetProcessIntegrityLevel(IntegrityLevel integrity_level) {

Powered by Google App Engine
This is Rietveld 408576698