summaryrefslogtreecommitdiff
path: root/cppu
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-04-20 09:46:56 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-04-23 22:29:25 +0200
commit256238ec6f84f94eaad5e667b9d507a7d9eaa136 (patch)
tree3ec0d1f43308b152b0396dcd951eca0c4cbe0c50 /cppu
parent500c4a1442919715a504e90db592dcce0f31e1a5 (diff)
cid#1462311 silence Use after free
etc. revert this hunk of commit 11785217594d863efb518aa8b8f2910cdcb9c59d Date: Tue Apr 14 14:55:22 2020 +0200 loplugin:buriedassign in c* just to silence coverity Change-Id: I6d8819a0ab073a56ab46944b170ef4ae3a28e4d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92552 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cppu')
-rw-r--r--cppu/source/typelib/typelib.cxx96
1 files changed, 48 insertions, 48 deletions
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index acd205ad07b2..bbcd87b25638 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -1363,68 +1363,68 @@ extern "C" void SAL_CALL typelib_typedescription_release(
{
sal_Int32 ref = osl_atomic_decrement( &pTD->nRefCount );
OSL_ASSERT(ref >= 0);
- if (0 != ref)
- return;
-
- TypeDescriptor_Init_Impl &rInit = Init::get();
- if( TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pTD->eTypeClass ) )
+ if (0 == ref)
{
- if( pTD->pWeakRef )
+ TypeDescriptor_Init_Impl &rInit = Init::get();
+ if( TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pTD->eTypeClass ) )
{
+ if( pTD->pWeakRef )
{
- MutexGuard aGuard( rInit.getMutex() );
- // remove this description from the weak reference
- pTD->pWeakRef->pType = nullptr;
+ {
+ MutexGuard aGuard( rInit.getMutex() );
+ // remove this description from the weak reference
+ pTD->pWeakRef->pType = nullptr;
+ }
+ typelib_typedescriptionreference_release( pTD->pWeakRef );
}
- typelib_typedescriptionreference_release( pTD->pWeakRef );
}
- }
- else
- {
- // this description is a reference too, so remove it from the hash table
- if( rInit.pWeakMap )
+ else
{
- MutexGuard aGuard( rInit.getMutex() );
- WeakMap_Impl::iterator aIt = rInit.pWeakMap->find( pTD->pTypeName->buffer );
- if( aIt != rInit.pWeakMap->end() && static_cast<void *>((*aIt).second) == static_cast<void *>(pTD) )
+ // this description is a reference too, so remove it from the hash table
+ if( rInit.pWeakMap )
{
- // remove only if it contains the same object
- rInit.pWeakMap->erase( aIt );
+ MutexGuard aGuard( rInit.getMutex() );
+ WeakMap_Impl::iterator aIt = rInit.pWeakMap->find( pTD->pTypeName->buffer );
+ if( aIt != rInit.pWeakMap->end() && static_cast<void *>((*aIt).second) == static_cast<void *>(pTD) )
+ {
+ // remove only if it contains the same object
+ rInit.pWeakMap->erase( aIt );
+ }
}
}
- }
- typelib_typedescription_destructExtendedMembers( pTD );
- rtl_uString_release( pTD->pTypeName );
+ typelib_typedescription_destructExtendedMembers( pTD );
+ rtl_uString_release( pTD->pTypeName );
#if OSL_DEBUG_LEVEL > 0
- switch( pTD->eTypeClass )
- {
- case typelib_TypeClass_SEQUENCE:
- osl_atomic_decrement( &rInit.nIndirectTypeDescriptionCount );
- break;
- case typelib_TypeClass_STRUCT:
- case typelib_TypeClass_EXCEPTION:
- osl_atomic_decrement( &rInit.nCompoundTypeDescriptionCount );
- break;
- case typelib_TypeClass_INTERFACE:
- osl_atomic_decrement( &rInit.nInterfaceTypeDescriptionCount );
- break;
- case typelib_TypeClass_INTERFACE_METHOD:
- osl_atomic_decrement( &rInit.nInterfaceMethodTypeDescriptionCount );
- break;
- case typelib_TypeClass_INTERFACE_ATTRIBUTE:
- osl_atomic_decrement( &rInit.nInterfaceAttributeTypeDescriptionCount );
- break;
- case typelib_TypeClass_ENUM:
- osl_atomic_decrement( &rInit.nEnumTypeDescriptionCount );
- break;
- default:
- osl_atomic_decrement( &rInit.nTypeDescriptionCount );
- }
+ switch( pTD->eTypeClass )
+ {
+ case typelib_TypeClass_SEQUENCE:
+ osl_atomic_decrement( &rInit.nIndirectTypeDescriptionCount );
+ break;
+ case typelib_TypeClass_STRUCT:
+ case typelib_TypeClass_EXCEPTION:
+ osl_atomic_decrement( &rInit.nCompoundTypeDescriptionCount );
+ break;
+ case typelib_TypeClass_INTERFACE:
+ osl_atomic_decrement( &rInit.nInterfaceTypeDescriptionCount );
+ break;
+ case typelib_TypeClass_INTERFACE_METHOD:
+ osl_atomic_decrement( &rInit.nInterfaceMethodTypeDescriptionCount );
+ break;
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+ osl_atomic_decrement( &rInit.nInterfaceAttributeTypeDescriptionCount );
+ break;
+ case typelib_TypeClass_ENUM:
+ osl_atomic_decrement( &rInit.nEnumTypeDescriptionCount );
+ break;
+ default:
+ osl_atomic_decrement( &rInit.nTypeDescriptionCount );
+ }
#endif
- freeTypeDescription(pTD);
+ freeTypeDescription(pTD);
+ }
}