From e5a0755bc2f8129cb854367740a02c859555c033 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 20 Jul 2012 15:55:05 +0200 Subject: new does not return null Change-Id: Iea00f7c6435c6ae3ccbb2f97ab4407df8b86c54b --- .../source/win32/shlxthandler/ooofilt/ooofilt.cxx | 36 ++++++++-------------- .../win32/shlxthandler/prophdl/propertyhdl.cxx | 3 -- shell/source/win32/shlxthandler/shlxthdl.cxx | 3 -- 3 files changed, 13 insertions(+), 29 deletions(-) (limited to 'shell') diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx index 9f37b3b62c0d..83df85f3981c 100644 --- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx +++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx @@ -817,21 +817,16 @@ SCODE STDMETHODCALLTYPE COooFilterCF::CreateInstance( if ( 0 != pUnkOuter ) return CLASS_E_NOAGGREGATION; pIUnk = new COooFilter(); - if ( 0 != pIUnk ) + if ( SUCCEEDED( pIUnk->QueryInterface( riid , ppvObject ) ) ) { - if ( SUCCEEDED( pIUnk->QueryInterface( riid , ppvObject ) ) ) - { - // Release extra refcount from QueryInterface - pIUnk->Release(); - } - else - { - delete pIUnk; - return E_UNEXPECTED; - } + // Release extra refcount from QueryInterface + pIUnk->Release(); } else - return E_OUTOFMEMORY; + { + delete pIUnk; + return E_UNEXPECTED; + } return S_OK; } @@ -919,19 +914,14 @@ extern "C" SCODE STDMETHODCALLTYPE DllGetClassObject( } else return CLASS_E_CLASSNOTAVAILABLE; - if ( 0 != pResult ) + if( SUCCEEDED( pResult->QueryInterface( iid, ppvObj ) ) ) + // Release extra refcount from QueryInterface + pResult->Release(); + else { - if( SUCCEEDED( pResult->QueryInterface( iid, ppvObj ) ) ) - // Release extra refcount from QueryInterface - pResult->Release(); - else - { - delete pImpl; - return E_UNEXPECTED; - } + delete pImpl; + return E_UNEXPECTED; } - else - return E_OUTOFMEMORY; return S_OK; } //F------------------------------------------------------------------------- diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx index 21a25132a773..009786794ee8 100644 --- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx +++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx @@ -432,9 +432,6 @@ extern "C" STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv) return E_NOINTERFACE; IUnknown* pUnk = new CClassFactory( rclsid ); - if ( 0 == pUnk ) - return E_OUTOFMEMORY; - *ppv = pUnk; return S_OK; } diff --git a/shell/source/win32/shlxthandler/shlxthdl.cxx b/shell/source/win32/shlxthandler/shlxthdl.cxx index 21257c717c5c..b4e1d2197b31 100644 --- a/shell/source/win32/shlxthandler/shlxthdl.cxx +++ b/shell/source/win32/shlxthandler/shlxthdl.cxx @@ -402,9 +402,6 @@ extern "C" STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv) OutputDebugStringFormat( "DllGetClassObject: Create CLSID_THUMBVIEWER_HANDLER\n" ); IUnknown* pUnk = new CClassFactory(rclsid); - if (0 == pUnk) - return E_OUTOFMEMORY; - *ppv = pUnk; return S_OK; } -- cgit