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

Unified Diff: sandbox/win/src/handle_closer.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
« no previous file with comments | « no previous file | sandbox/win/src/handle_table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/win/src/handle_closer.cc
diff --git a/sandbox/win/src/handle_closer.cc b/sandbox/win/src/handle_closer.cc
index a47bf6564cfc78ef9ecfb0d9fe0c96fdfe10d1d0..3d0214fee49701f20c1a85ea22a8c793bc4ad08e 100644
--- a/sandbox/win/src/handle_closer.cc
+++ b/sandbox/win/src/handle_closer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
rvargas (doing something else) 2013/06/05 22:27:36 We should not update the year on CR headers.
Derek Bruening 2013/06/06 04:33:25 Hmm, yes, this is in http://www.chromium.org/devel
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -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)));
+ CHECK(name.get());
rvargas (doing something else) 2013/06/05 22:27:36 do we really net a check here?
Derek Bruening 2013/06/06 04:33:25 Is there a Cr convention on OOM handling? I saw m
jschuh 2013/06/06 13:21:21 Wouldn't a DCHECK be fine then? Since for all inte
result = QueryObject(handle, ObjectNameInformation, name.get(),
size, &size);
} while (result == STATUS_INFO_LENGTH_MISMATCH ||
« no previous file with comments | « no previous file | sandbox/win/src/handle_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698