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

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

Issue 16404003: Fix new[]/delete mismatches in sandbox handle code by switching to scoped_ptr<C, base::FreeDeleter>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« sandbox/win/src/handle_closer.cc ('K') | « sandbox/win/src/handle_closer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/win/src/handle_table.cc
diff --git a/sandbox/win/src/handle_table.cc b/sandbox/win/src/handle_table.cc
index a497f7489091b4a0cdd0edeaa6d68ded4a562033..23217ddb76ac2c47e25ac46f3ebae7e76bfcdba4 100644
--- a/sandbox/win/src/handle_table.cc
+++ b/sandbox/win/src/handle_table.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2013 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.
@@ -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)));
+ CHECK(name.get());
result = QueryObject(reinterpret_cast<HANDLE>(
handle_entry_->Handle), ObjectNameInformation, name.get(),
size, &size);
« sandbox/win/src/handle_closer.cc ('K') | « sandbox/win/src/handle_closer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698