Kaydet (Commit) 9da54417 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

coverity#738978: Fix use after free.

This was a corner case after the container types removal.

Change-Id: I2200b7fc2d38946403d289e62ad602a63bd1cf6e
üst c7433242
...@@ -158,7 +158,6 @@ void LinkManager::Remove( sal_uInt16 nPos, sal_uInt16 nCnt ) ...@@ -158,7 +158,6 @@ void LinkManager::Remove( sal_uInt16 nPos, sal_uInt16 nCnt )
sal_Bool LinkManager::Insert( SvBaseLink* pLink ) sal_Bool LinkManager::Insert( SvBaseLink* pLink )
{ {
// No duplicate links inserted
for( sal_uInt16 n = 0; n < aLinkTbl.size(); ++n ) for( sal_uInt16 n = 0; n < aLinkTbl.size(); ++n )
{ {
SvBaseLinkRef* pTmp = aLinkTbl[ n ]; SvBaseLinkRef* pTmp = aLinkTbl[ n ];
...@@ -167,9 +166,8 @@ sal_Bool LinkManager::Insert( SvBaseLink* pLink ) ...@@ -167,9 +166,8 @@ sal_Bool LinkManager::Insert( SvBaseLink* pLink )
delete pTmp; delete pTmp;
aLinkTbl.erase( aLinkTbl.begin() + n-- ); aLinkTbl.erase( aLinkTbl.begin() + n-- );
} }
else if( pLink == *pTmp )
if( pLink == *pTmp ) return sal_False; // No duplicate links inserted
return sal_False;
} }
SvBaseLinkRef* pTmp = new SvBaseLinkRef( pLink ); SvBaseLinkRef* pTmp = new SvBaseLinkRef( pLink );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment