diff options
author | bruening@chromium.org <bruening@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-08 06:15:40 +0000 |
---|---|---|
committer | bruening@chromium.org <bruening@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-08 06:15:40 +0000 |
commit | b6572231bcf8d1cac040802cd14a4b670e94ad94 (patch) | |
tree | a8ce074c9dccb99fb053b9faa2cb7facc378e79d /sandbox/win | |
parent | 92201e3dc535f75bdfdfd02eda6d6d2a1c427a93 (diff) | |
download | chromium_src-b6572231bcf8d1cac040802cd14a4b670e94ad94.zip chromium_src-b6572231bcf8d1cac040802cd14a4b670e94ad94.tar.gz chromium_src-b6572231bcf8d1cac040802cd14a4b670e94ad94.tar.bz2 |
Fix new[]/delete mismatches in sandbox handle code by switching to scoped_ptr<C, base::FreeDeleter>.
BUG=246802
R=jschuh@chromium.org
TEST=browser_tests under Dr. Memory
Review URL: https://chromiumcodereview.appspot.com/16404003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/win')
-rw-r--r-- | sandbox/win/src/handle_closer.cc | 5 | ||||
-rw-r--r-- | sandbox/win/src/handle_table.cc | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/sandbox/win/src/handle_closer.cc b/sandbox/win/src/handle_closer.cc index a47bf65..39915a9 100644 --- a/sandbox/win/src/handle_closer.cc +++ b/sandbox/win/src/handle_closer.cc @@ -180,11 +180,12 @@ bool GetHandleName(HANDLE handle, string16* handle_name) { ResolveNTFunctionPtr("NtQueryObject", &QueryObject); ULONG size = MAX_PATH; - scoped_ptr<UNICODE_STRING> name; + scoped_ptr<UNICODE_STRING, base::FreeDeleter> name; NTSTATUS result; do { - name.reset(reinterpret_cast<UNICODE_STRING*>(new BYTE[size])); + name.reset(static_cast<UNICODE_STRING*>(malloc(size))); + DCHECK(name.get()); result = QueryObject(handle, ObjectNameInformation, name.get(), size, &size); } while (result == STATUS_INFO_LENGTH_MISMATCH || diff --git a/sandbox/win/src/handle_table.cc b/sandbox/win/src/handle_table.cc index a497f74..7230dff 100644 --- a/sandbox/win/src/handle_table.cc +++ b/sandbox/win/src/handle_table.cc @@ -7,6 +7,7 @@ #include <algorithm> #include <cstdlib> +#include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "sandbox/win/src/win_utils.h" @@ -120,9 +121,10 @@ void HandleTable::HandleEntry::UpdateInfo(UpdateType flag) { case UPDATE_INFO_AND_NAME: if (type_info_buffer_.size() && handle_name_.empty()) { ULONG size = MAX_PATH; - scoped_ptr<UNICODE_STRING> name; + scoped_ptr<UNICODE_STRING, base::FreeDeleter> name; do { - name.reset(reinterpret_cast<UNICODE_STRING*>(new BYTE[size])); + name.reset(static_cast<UNICODE_STRING*>(malloc(size))); + DCHECK(name.get()); result = QueryObject(reinterpret_cast<HANDLE>( handle_entry_->Handle), ObjectNameInformation, name.get(), size, &size); |