diff options
author | timurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-28 09:58:21 +0000 |
---|---|---|
committer | timurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-28 09:58:21 +0000 |
commit | 0a64d48cec9e09da167544d31ceee24c768c4472 (patch) | |
tree | 2deac5c6133bb118cc8a302c4ef5810941116037 /sandbox | |
parent | d978042f1ce6945b5d4df29a84086ae10af7dd4b (diff) | |
download | chromium_src-0a64d48cec9e09da167544d31ceee24c768c4472.zip chromium_src-0a64d48cec9e09da167544d31ceee24c768c4472.tar.gz chromium_src-0a64d48cec9e09da167544d31ceee24c768c4472.tar.bz2 |
Avoid an extra if() which is not required and is wrong
Info:
a) args[i] is uninitialized for (i >= ipc_params->GetParamsCount())
and sometimes for smaller (i) as well (see GetArgs()).
Hence, if() is wrong.
b) However, when args[i] is uninitialized the ipc_params->args[i] holds INVALID_TYPE.
Hence, the if() is redundant.
BUG=87078
TEST=no more uninit reports under Dr. Memory
Review URL: http://codereview.chromium.org/7234009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/src/sharedmem_ipc_server.cc | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/sandbox/src/sharedmem_ipc_server.cc b/sandbox/src/sharedmem_ipc_server.cc index 53286b7..18d7f52 100644 --- a/sandbox/src/sharedmem_ipc_server.cc +++ b/sandbox/src/sharedmem_ipc_server.cc @@ -129,20 +129,18 @@ bool SharedMemIPCServer::Init(void* shared_mem, size_t shared_size, // Releases memory allocated for IPC arguments, if needed. void ReleaseArgs(const IPCParams* ipc_params, void* args[kMaxIpcParams]) { for (size_t i = 0; i < kMaxIpcParams; i++) { - if (args[i]) { - switch (ipc_params->args[i]) { - case WCHAR_TYPE: { - delete reinterpret_cast<std::wstring*>(args[i]); - args[i] = NULL; - break; - } - case INOUTPTR_TYPE: { - delete reinterpret_cast<CountedBuffer*>(args[i]); - args[i] = NULL; - break; - } - default: break; + switch (ipc_params->args[i]) { + case WCHAR_TYPE: { + delete reinterpret_cast<std::wstring*>(args[i]); + args[i] = NULL; + break; + } + case INOUTPTR_TYPE: { + delete reinterpret_cast<CountedBuffer*>(args[i]); + args[i] = NULL; + break; } + default: break; } } } |