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
This commit is contained in:
@@ -129,20 +129,18 @@ bool SharedMemIPCServer::Init(void* shared_mem, size_t shared_size,
|
|||||||
// Releases memory allocated for IPC arguments, if needed.
|
// Releases memory allocated for IPC arguments, if needed.
|
||||||
void ReleaseArgs(const IPCParams* ipc_params, void* args[kMaxIpcParams]) {
|
void ReleaseArgs(const IPCParams* ipc_params, void* args[kMaxIpcParams]) {
|
||||||
for (size_t i = 0; i < kMaxIpcParams; i++) {
|
for (size_t i = 0; i < kMaxIpcParams; i++) {
|
||||||
if (args[i]) {
|
switch (ipc_params->args[i]) {
|
||||||
switch (ipc_params->args[i]) {
|
case WCHAR_TYPE: {
|
||||||
case WCHAR_TYPE: {
|
delete reinterpret_cast<std::wstring*>(args[i]);
|
||||||
delete reinterpret_cast<std::wstring*>(args[i]);
|
args[i] = NULL;
|
||||||
args[i] = NULL;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
case INOUTPTR_TYPE: {
|
|
||||||
delete reinterpret_cast<CountedBuffer*>(args[i]);
|
|
||||||
args[i] = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
|
case INOUTPTR_TYPE: {
|
||||||
|
delete reinterpret_cast<CountedBuffer*>(args[i]);
|
||||||
|
args[i] = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user