Commit 7804b679 authored by wfh's avatar wfh Committed by Commit bot

Fix scoped_ptr free to use delete [] instead of delete.

BUG=101717

Review URL: https://codereview.chromium.org/1055433003

Cr-Commit-Position: refs/heads/master@{#324013}
parent 33370e19
...@@ -351,22 +351,21 @@ bool GetPathFromHandle(HANDLE handle, base::string16* path) { ...@@ -351,22 +351,21 @@ bool GetPathFromHandle(HANDLE handle, base::string16* path) {
NtQueryObjectFunction NtQueryObject = NULL; NtQueryObjectFunction NtQueryObject = NULL;
ResolveNTFunctionPtr("NtQueryObject", &NtQueryObject); ResolveNTFunctionPtr("NtQueryObject", &NtQueryObject);
OBJECT_NAME_INFORMATION initial_buffer; OBJECT_NAME_INFORMATION* name = NULL;
OBJECT_NAME_INFORMATION* name = &initial_buffer; ULONG size = 0;
ULONG size = sizeof(initial_buffer);
// Query the name information a first time to get the size of the name. // Query the name information a first time to get the size of the name.
NTSTATUS status = NtQueryObject(handle, ObjectNameInformation, name, size, NTSTATUS status = NtQueryObject(handle, ObjectNameInformation, name, size,
&size); &size);
scoped_ptr<OBJECT_NAME_INFORMATION> name_ptr; if (!size)
if (size) { return false;
name = reinterpret_cast<OBJECT_NAME_INFORMATION*>(new BYTE[size]);
name_ptr.reset(name); scoped_ptr<BYTE[]> name_ptr(new BYTE[size]);
name = reinterpret_cast<OBJECT_NAME_INFORMATION*>(name_ptr.get());
// Query the name information a second time to get the name of the // Query the name information a second time to get the name of the
// object referenced by the handle. // object referenced by the handle.
status = NtQueryObject(handle, ObjectNameInformation, name, size, &size); status = NtQueryObject(handle, ObjectNameInformation, name, size, &size);
}
if (STATUS_SUCCESS != status) if (STATUS_SUCCESS != status)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment