diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 19:39:55 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 19:39:55 +0000 |
commit | d92a7e670753fa0a24e592acf412d752e0ae6cd8 (patch) | |
tree | a547299764a7846ab523038575790e6f6ec242f9 /sandbox/src/acl.cc | |
parent | 73097564b57bad21efbb72e49a0edf0d13e9c249 (diff) | |
download | chromium_src-d92a7e670753fa0a24e592acf412d752e0ae6cd8.zip chromium_src-d92a7e670753fa0a24e592acf412d752e0ae6cd8.tar.gz chromium_src-d92a7e670753fa0a24e592acf412d752e0ae6cd8.tar.bz2 |
Fix memory dealocatiom mismatch by using scoped_ptr_malloc
- Flagged by almost all tools
BUG=101717
TEST= sandbox tests in the waterfall are green.
Review URL: http://codereview.chromium.org/9107029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/src/acl.cc')
-rw-r--r-- | sandbox/src/acl.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sandbox/src/acl.cc b/sandbox/src/acl.cc index 9e7111d..4869bb0 100644 --- a/sandbox/src/acl.cc +++ b/sandbox/src/acl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,7 +12,7 @@ namespace sandbox { bool GetDefaultDacl(HANDLE token, - scoped_ptr<TOKEN_DEFAULT_DACL>* default_dacl) { + scoped_ptr_malloc<TOKEN_DEFAULT_DACL>* default_dacl) { if (token == NULL) return false; @@ -26,7 +26,7 @@ bool GetDefaultDacl(HANDLE token, } TOKEN_DEFAULT_DACL* acl = - reinterpret_cast<TOKEN_DEFAULT_DACL*>(new char[length]); + reinterpret_cast<TOKEN_DEFAULT_DACL*>(malloc(length)); default_dacl->reset(acl); if (!::GetTokenInformation(token, TokenDefaultDacl, default_dacl->get(), @@ -59,7 +59,7 @@ bool AddSidToDefaultDacl(HANDLE token, const Sid& sid, ACCESS_MASK access) { if (token == NULL) return false; - scoped_ptr<TOKEN_DEFAULT_DACL> default_dacl; + scoped_ptr_malloc<TOKEN_DEFAULT_DACL> default_dacl; if (!GetDefaultDacl(token, &default_dacl)) return false; @@ -78,9 +78,9 @@ bool AddSidToDefaultDacl(HANDLE token, const Sid& sid, ACCESS_MASK access) { bool AddUserSidToDefaultDacl(HANDLE token, ACCESS_MASK access) { DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE; - TOKEN_USER* token_user = reinterpret_cast<TOKEN_USER*>(new BYTE[size]); + TOKEN_USER* token_user = reinterpret_cast<TOKEN_USER*>(malloc(size)); - scoped_ptr<TOKEN_USER> token_user_ptr(token_user); + scoped_ptr_malloc<TOKEN_USER> token_user_ptr(token_user); if (!::GetTokenInformation(token, TokenUser, token_user, size, &size)) return false; |