[Libreoffice-bugs] [Bug 111894] New: PaletteManager::LoadPalettes() leaks memory
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Fri Aug 18 07:47:58 UTC 2017
https://bugs.documentfoundation.org/show_bug.cgi?id=111894
Bug ID: 111894
Summary: PaletteManager::LoadPalettes() leaks memory
Product: LibreOffice
Version: 6.0.0.0.alpha0+ Master
Hardware: x86-64 (AMD64)
OS: Mac OS X (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: framework
Assignee: libreoffice-bugs at lists.freedesktop.org
Reporter: iplaw67 at tuta.io
Description:
PaletteManager::LoadPalettes() leaks memory with multiple invocations
Steps to Reproduce:
Steps to Reproduce:
1. Start XCode, then Instruments.app
2. Choose Memory Leak profile tool
3. Select LibreOffice.app in instdir as target process
4. Click on the record button, LODev is started by the profiling tool
5. Wait for the StartCenter to load.
6. Click on the new Writer document icon to open a blank Writer document.
7. Type some random text.
8. Right mouse button click on the page
9. Select Area, then Pattern.
10. Close the Writer file without saving.
11. Stop recording.
12. Analyse the profile trace.
Actual Results:
Memory leak in PaletteManager::LoadPalettes()
Expected Results:
Shouldn't leak memory
Reproducible: Always
User Profile Reset: No
Additional Info:
The code pointed to by the profile tool is in PaletteManager.cxx
void PaletteManager::LoadPalettes()
{
m_Palettes.clear();
OUString aPalPaths = SvtPathOptions().GetPalettePath();
std::stack<OUString> aDirs;
sal_Int32 nIndex = 0;
do
{
aDirs.push(aPalPaths.getToken(0, ';', nIndex));
}
while (nIndex >= 0);
std::set<OUString> aNames;
//try all entries palette path list user first, then
//system, ignoring duplicate file names
while (!aDirs.empty())
{
OUString aPalPath = aDirs.top();
aDirs.pop();
osl::Directory aDir(aPalPath);
osl::DirectoryItem aDirItem;
osl::FileStatus aFileStat( osl_FileStatus_Mask_FileName |
osl_FileStatus_Mask_FileURL |
osl_FileStatus_Mask_Type );
if( aDir.open() == osl::FileBase::E_None )
{
while( aDir.getNextItem(aDirItem) == osl::FileBase::E_None )
{
aDirItem.getFileStatus(aFileStat);
if(aFileStat.isRegular() || aFileStat.isLink())
{
OUString aFName = aFileStat.getFileName();
INetURLObject aURLObj( aFileStat.getFileURL() );
OUString aFNameWithoutExt = aURLObj.GetBase();
if (aNames.find(aFName) == aNames.end())
{
std::unique_ptr<Palette> pPalette;
if( aFName.endsWithIgnoreAsciiCase(".gpl") )
pPalette.reset(new
PaletteGPL(aFileStat.getFileURL(), aFNameWithoutExt));
else if( aFName.endsWithIgnoreAsciiCase(".soc") )
pPalette.reset(new
PaletteSOC(aFileStat.getFileURL(), aFNameWithoutExt));
else if ( aFName.endsWithIgnoreAsciiCase(".ase") )
pPalette.reset(new
PaletteASE(aFileStat.getFileURL(), aFNameWithoutExt));
if( pPalette && pPalette->IsValid() )
m_Palettes.push_back( std::move(pPalette) );
aNames.insert(aFNameWithoutExt);
}
}
}
}
}
}
and in particular, line 109:
pPalette.reset(new PaletteSOC(aFileStat.getFileURL(), aFNameWithoutExt));
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0)
Gecko/20100101 Firefox/54.0
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20170818/3106b1ae/attachment.html>
More information about the Libreoffice-bugs
mailing list