Hello,

Cppcheck reported this:
[source/inprocserv/inprocembobj.cxx:783] ->
[source/inprocserv/inprocembobj.cxx:784]: (performance) Variable 'hr' is
reassigned a value before the old one has been used

Here are the lines:
    778         HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject,
(void**)&pOleObject );
    779 
    780         ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance
problem
    781         if ( SUCCEEDED( hr ) && pOleObject )
    782         {
    783             hr = pOleObject->Close( dwSaveOption );
    784             hr = CoDisconnectObject(
(IUnknown*)(IPersistStorage*)this, 0 );
    785         }

(see
http://opengrok.libreoffice.org/xref/core/embedserv/source/inprocserv/inprocembobj.cxx#778)
Moreover, the result of CoDisconnectObject isn't tested too.

I thought about adding after 783 and 784 (so after both lines) this:
if( !SUCCEEDED( hr ) ) return hr;

What do you think?

Julien



--
View this message in context: 
http://nabble.documentfoundation.org/No-test-on-the-return-of-pOleObject-Close-in-embedserv-source-inprocserv-inprocembobj-cxx-tp4025755.html
Sent from the Dev mailing list archive at Nabble.com.
_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to