[Libreoffice-commits] core.git: sfx2/source

Jan Holesovsky kendy at suse.cz
Fri Feb 15 10:42:51 PST 2013


 sfx2/source/appl/linkmgr2.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 9da54417345c6069d995bdabae7d7dd6de40d1a6
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri Feb 15 19:38:23 2013 +0100

    coverity#738978: Fix use after free.
    
    This was a corner case after the container types removal.
    
    Change-Id: I2200b7fc2d38946403d289e62ad602a63bd1cf6e

diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 08ff451..91cf2e7 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -158,7 +158,6 @@ void LinkManager::Remove( sal_uInt16 nPos, sal_uInt16 nCnt )
 
 sal_Bool LinkManager::Insert( SvBaseLink* pLink )
 {
-  // No duplicate links inserted
     for( sal_uInt16 n = 0; n < aLinkTbl.size(); ++n )
     {
         SvBaseLinkRef* pTmp = aLinkTbl[ n ];
@@ -167,9 +166,8 @@ sal_Bool LinkManager::Insert( SvBaseLink* pLink )
             delete pTmp;
             aLinkTbl.erase( aLinkTbl.begin() + n-- );
         }
-
-        if( pLink == *pTmp )
-            return sal_False;
+        else if( pLink == *pTmp )
+            return sal_False; // No duplicate links inserted
     }
 
     SvBaseLinkRef* pTmp = new SvBaseLinkRef( pLink );


More information about the Libreoffice-commits mailing list