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

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

Issue 10844003: Fixing a couple of issues in sandbox::RestrictedToken: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unit tests. Created 8 years, 5 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
« no previous file with comments | « no previous file | sandbox/win/src/restricted_token_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/win/src/restricted_token.cc
diff --git a/sandbox/win/src/restricted_token.cc b/sandbox/win/src/restricted_token.cc
index 8a096a17f4509a8a4b0f9ee7f83dcc493aae70d8..57173da6e4574dfdab9b0774959a0483285f47e7 100644
--- a/sandbox/win/src/restricted_token.cc
+++ b/sandbox/win/src/restricted_token.cc
@@ -26,9 +26,9 @@ unsigned RestrictedToken::Init(const HANDLE effective_token) {
effective_token,
::GetCurrentProcess(),
&effective_token_dup,
- DUPLICATE_SAME_ACCESS,
+ 0,
FALSE,
- 0)) { // no special options
+ DUPLICATE_SAME_ACCESS)) {
effective_token_ = effective_token_dup;
} else {
return ::GetLastError();
@@ -263,13 +263,16 @@ unsigned RestrictedToken::AddUserSidForDenyOnly() {
size,
&size);
- Sid user = reinterpret_cast<SID*>(token_user->User.Sid);
- delete[] reinterpret_cast<BYTE*>(token_user);
-
- if (!result)
+ if (!result) {
+ delete[] reinterpret_cast<BYTE*>(token_user);
return ::GetLastError();
+ }
+ Sid user = reinterpret_cast<SID*>(token_user->User.Sid);
sids_for_deny_only_.push_back(user);
+
+ delete[] reinterpret_cast<BYTE*>(token_user);
+
return ERROR_SUCCESS;
}
@@ -323,6 +326,7 @@ unsigned RestrictedToken::DeleteAllPrivileges(
}
delete[] reinterpret_cast<BYTE *>(token_privileges);
+
return ERROR_SUCCESS;
}
@@ -406,14 +410,16 @@ unsigned RestrictedToken::AddRestrictingSidCurrentUser() {
size,
&size);
- Sid user = reinterpret_cast<SID*>(token_user->User.Sid);
- delete[] reinterpret_cast<BYTE*>(token_user);
-
-
- if (!result)
+ if (!result) {
+ delete[] reinterpret_cast<BYTE*>(token_user);
return ::GetLastError();
+ }
+ Sid user = reinterpret_cast<SID*>(token_user->User.Sid);
sids_to_restrict_.push_back(user);
+
+ delete[] reinterpret_cast<BYTE*>(token_user);
+
return ERROR_SUCCESS;
}
« no previous file with comments | « no previous file | sandbox/win/src/restricted_token_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698