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:
@@ -384,18 +384,12 @@ BOOL WINAPI Monitor2EnumPorts(HANDLE,
|
|||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI Monitor2OpenPort(HANDLE, wchar_t*, HANDLE* 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) {
|
if (handle == NULL) {
|
||||||
LOG(ERROR) << "handle should not be NULL.";
|
LOG(ERROR) << "handle should not be NULL.";
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
*handle = (HANDLE)port_data;
|
*handle = new PortData();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,13 +543,8 @@ BOOL WINAPI Monitor2XcvOpenPort(HANDLE,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
XcvUiData* xcv_data = new XcvUiData();
|
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;
|
xcv_data->granted_access = granted_access;
|
||||||
*handle = (HANDLE)xcv_data;
|
*handle = xcv_data;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,22 +610,18 @@ BOOL WINAPI MonitorUiConfigureOrDeletePortUI(const wchar_t*,
|
|||||||
|
|
||||||
MONITOR2* WINAPI InitializePrintMonitor2(MONITORINIT*,
|
MONITOR2* WINAPI InitializePrintMonitor2(MONITORINIT*,
|
||||||
HANDLE* handle) {
|
HANDLE* handle) {
|
||||||
cloud_print::MonitorData* monitor_data = new cloud_print::MonitorData;
|
if (handle == NULL) {
|
||||||
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 {
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return NULL;
|
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;
|
return &cloud_print::g_monitor_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user