0

Removed NULL checks for operator new() return value.

BUG=271530

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227702 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
vitalybuka@chromium.org
2013-10-09 08:24:40 +00:00
parent e5996d2906
commit 5c88c1a11e

@ -384,18 +384,12 @@ BOOL WINAPI Monitor2EnumPorts(HANDLE,
}
BOOL WINAPI Monitor2OpenPort(HANDLE, wchar_t*, HANDLE* handle) {
PortData* port_data = new PortData();
if (port_data == NULL) {
LOG(ERROR) << "Unable to allocate memory for internal structures.";
SetLastError(E_OUTOFMEMORY);
return FALSE;
}
if (handle == NULL) {
LOG(ERROR) << "handle should not be NULL.";
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
*handle = (HANDLE)port_data;
*handle = new PortData();
return TRUE;
}
@ -549,13 +543,8 @@ BOOL WINAPI Monitor2XcvOpenPort(HANDLE,
return FALSE;
}
XcvUiData* xcv_data = new XcvUiData();
if (xcv_data == NULL) {
LOG(ERROR) << "Unable to allocate memory for internal structures.";
SetLastError(E_OUTOFMEMORY);
return FALSE;
}
xcv_data->granted_access = granted_access;
*handle = (HANDLE)xcv_data;
*handle = xcv_data;
return TRUE;
}
@ -621,22 +610,18 @@ BOOL WINAPI MonitorUiConfigureOrDeletePortUI(const wchar_t*,
MONITOR2* WINAPI InitializePrintMonitor2(MONITORINIT*,
HANDLE* handle) {
cloud_print::MonitorData* monitor_data = new cloud_print::MonitorData;
if (monitor_data == NULL) {
return NULL;
}
if (handle != NULL) {
*handle = (HANDLE)monitor_data;
if (!cloud_print::kIsUnittest) {
// Unit tests set up their own AtExitManager
monitor_data->at_exit_manager.reset(new base::AtExitManager());
// Single spooler.exe handles verbose users.
PathService::DisableCache();
}
} else {
if (handle == NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
cloud_print::MonitorData* monitor_data = new cloud_print::MonitorData;
*handle = monitor_data;
if (!cloud_print::kIsUnittest) {
// Unit tests set up their own AtExitManager
monitor_data->at_exit_manager.reset(new base::AtExitManager());
// Single spooler.exe handles verbose users.
PathService::DisableCache();
}
return &cloud_print::g_monitor_2;
}