diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-30 18:13:00 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-30 18:13:00 +0000 |
commit | 8989e075ee383f28acab94dbbc31548d0c105b99 (patch) | |
tree | 1545f634a1c357e6ca5cceefeb558daf4a67d972 /sandbox | |
parent | 89ede6ed2a927f97def9cfd019933b614d28013c (diff) | |
download | chromium_src-8989e075ee383f28acab94dbbc31548d0c105b99.zip chromium_src-8989e075ee383f28acab94dbbc31548d0c105b99.tar.gz chromium_src-8989e075ee383f28acab94dbbc31548d0c105b99.tar.bz2 |
Fix potential memleak in GetArgs.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/151045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/src/sharedmem_ipc_server.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sandbox/src/sharedmem_ipc_server.cc b/sandbox/src/sharedmem_ipc_server.cc index 6100cf3..8250fa8 100644 --- a/sandbox/src/sharedmem_ipc_server.cc +++ b/sandbox/src/sharedmem_ipc_server.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 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. @@ -160,13 +160,13 @@ bool GetArgs(CrossCallParamsEx* params, IPCParams* ipc_params, ipc_params->args[i] = type; switch (type) { case WCHAR_TYPE: { - std::wstring* data = new std::wstring; - if (!params->GetParameterStr(i, data)) { + scoped_ptr<std::wstring> data(new std::wstring); + if (!params->GetParameterStr(i, data.get())) { args[i] = 0; ReleaseArgs(ipc_params, args); return false; } - args[i] = data; + args[i] = data.release(); break; } case ULONG_TYPE: { @@ -212,7 +212,7 @@ bool SharedMemIPCServer::InvokeCallback(const ServerControl* service_context, uint32 tag = params->GetTag(); COMPILE_ASSERT(0 == INVALID_TYPE, Incorrect_type_enum); - IPCParams ipc_params = {0} ; + IPCParams ipc_params = {0}; ipc_params.ipc_tag = tag; void* args[kMaxIpcParams]; @@ -382,7 +382,7 @@ bool SharedMemIPCServer::MakeEvents(HANDLE* server_ping, HANDLE* server_pong, HANDLE* client_ping, HANDLE* client_pong) { // Note that the IPC client has no right to delete the events. That would // cause problems. The server *owns* the events. - const DWORD kDesiredAccess = SYNCHRONIZE | EVENT_MODIFY_STATE ; + const DWORD kDesiredAccess = SYNCHRONIZE | EVENT_MODIFY_STATE; // The events are auto reset, and start not signaled. *server_ping = ::CreateEventW(NULL, FALSE, FALSE, NULL); |