Issue 120867 - In SfxLibraryContainer::storeLibraries_Impl(), the created pLibArray object need free before returning from branch code
In SfxLibraryContainer::storeLibraries_Impl(), the created pLibArray object n...
Status: CLOSED FIXED
Product: performance
Classification: Code
Component: code
AOO 3.4.1
All All
: P3 normal (vote)
: AOO 4.0
Assigned To: zhang jianfang
:
Depends on:
Blocks: 120975
  Show dependency treegraph
 
Reported: 2012-09-10 05:57 UTC by zhang jianfang
Modified: 2013-07-12 10:54 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments
fix code patch (597 bytes, patch)
2012-09-10 06:05 UTC, zhang jianfang
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
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