Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 07/17/2012 12:22 AM, Eike Rathke wrote:
  dtrans/source/win32/dtobj/XTDataObject.cxx |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 73db878b17c6f57be5559ac5f7780b43ab690559
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Sat Jul 14 16:00:50 2012 +0200

     Correct check after memory allocation.

     ppenum is already tested for NULL at the beginning of the function.
     What is intended here is to know if the memory allocation succeeded.

...but failing memory allocation leads to new throwing std::bad_alloc, not returning null; so the check can be removed completely.

Stephan


     Found by cppcheck.

     Change-Id: I31a3bed93b5dfe1a4d384478267f7c8cc0421181

diff --git a/dtrans/source/win32/dtobj/XTDataObject.cxx b/dtrans/source/win32/dtobj/XTDataObject.cxx
index 858a337..ec3d201 100644
--- a/dtrans/source/win32/dtobj/XTDataObject.cxx
+++ b/dtrans/source/win32/dtobj/XTDataObject.cxx
@@ -832,7 +832,7 @@ STDMETHODIMP CEnumFormatEtc::Clone( IEnumFORMATETC** ppenum )
          return E_INVALIDARG;

      *ppenum = new CEnumFormatEtc( m_lpUnkOuter, m_FormatEtcContainer );
-    if ( NULL != ppenum )
+    if ( NULL != *ppenum )
          static_cast< LPUNKNOWN >( *ppenum )->AddRef( );

      return ( NULL != *ppenum ) ? S_OK : E_OUTOFMEMORY;

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.