Issue 120867

Summary: In SfxLibraryContainer::storeLibraries_Impl(), the created pLibArray object need free before returning from branch code
Product: performance Reporter: zhang jianfang <zhangjf>
Component: codeAssignee: zhang jianfang <zhangjf>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3    
Version: AOO 3.4.1   
Target Milestone: 4.0.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 120975    
Attachments:
Description Flags
fix code patch none

Description zhang jianfang 2012-09-10 05:57:17 UTC
in api void SfxLibraryContainer::storeLibraries_Impl(), in some cases it returns from branch code, while the created ::xmlscript::LibDescriptorArray object is not freed.

// Methods of new XLibraryStorage interface?
void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& xStorage, sal_Bool bComplete )
{
  ...

	::xmlscript::LibDescriptorArray* pLibArray = new ::xmlscript::LibDescriptorArray( nLibsToSave );
	
	...
	
	        // Don't write if only empty standard lib exists
        if ( ( nNameCount == 1 ) && ( aNames[0].equalsAscii( "Standard" ) ) )
        {
		    Any aLibAny = maNameContainer.getByName( aNames[0] );
		    Reference< XNameAccess > xNameAccess;
		    aLibAny >>= xNameAccess;
		    if ( !xNameAccess->hasElements() )  // no free pLibArray action in this branch code
		        return;
        }
        ...
        
	delete pLibArray;
}
Comment 1 SVN Robot 2012-09-10 06:04:24 UTC
"zhangjf" committed SVN revision 1382647 into trunk:
#i120867#, in SfxLibraryContainer::storeLibraries_Impl(),need to free created...
Comment 2 zhang jianfang 2012-09-10 06:05:18 UTC
Created attachment 79370 [details]
fix code patch

In SfxLibraryContainer::storeLibraries_Impl(),need to free created pLibArray object before returning from branch code.
Comment 3 zhang jianfang 2012-09-10 06:05:47 UTC
change to resolved state