diff options
author | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-09 08:24:40 +0000 |
---|---|---|
committer | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-09 08:24:40 +0000 |
commit | 5c88c1a11e59f26620dfd77ed62f7047aba6ec9c (patch) | |
tree | 8108be9c26d0bddda8282bc4415b016d5b92a39e /cloud_print | |
parent | e5996d2906f714b380bce556e3da98a64f87b5dd (diff) | |
download | chromium_src-5c88c1a11e59f26620dfd77ed62f7047aba6ec9c.zip chromium_src-5c88c1a11e59f26620dfd77ed62f7047aba6ec9c.tar.gz chromium_src-5c88c1a11e59f26620dfd77ed62f7047aba6ec9c.tar.bz2 |
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
Diffstat (limited to 'cloud_print')
-rw-r--r-- | cloud_print/virtual_driver/win/port_monitor/port_monitor.cc | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc index ce146c7..d20b5851 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc @@ -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; } |