| Summary: | CoreTextGlyphFallbackSubstitution::FindFontSubstitute() leaks memory on invocation | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Alex Thurgood <iplaw67> |
| Component: | graphics stack | Assignee: | Julien Nabet <serval2412> |
| Status: | VERIFIED FIXED | ||
| Severity: | normal | CC: | khaled, serval2412, telesto |
| Priority: | medium | ||
| Version: | 6.0.0.0.alpha0+ | ||
| Hardware: | x86-64 (AMD64) | ||
| OS: | macOS (All) | ||
| See Also: | https://bugs.documentfoundation.org/show_bug.cgi?id=111432 | ||
| Whiteboard: | target:6.0.0 target:5.4.1 | ||
| Crash report or crash signature: | Regression By: | ||
| Attachments: | Screenshot of memory leak profiling with Instruments.app | ||
|
Description
Alex Thurgood
2017-08-08 13:20:12 UTC
Created attachment 135286 [details]
Screenshot of memory leak profiling with Instruments.app
The leak appears to occur here :
line 80, salgdi.xx :
CTFontDescriptorRef pDesc = CTFontCopyFontDescriptor(pFallback);
from this block :
bool bFound = false;
CoreTextStyle rStyle(rPattern);
CTFontRef pFont = static_cast<CTFontRef>(CFDictionaryGetValue(rStyle.GetStyleDict(), kCTFontAttributeName));
CFStringRef pStr = CreateCFString(rMissingChars);
if (pStr)
{
CTFontRef pFallback = CTFontCreateForString(pFont, pStr, CFRangeMake(0, CFStringGetLength(pStr)));
if (pFallback)
{
bFound = true;
CTFontDescriptorRef pDesc = CTFontCopyFontDescriptor(pFallback);
FontAttributes rAttr = DevFontFromCTFontDescriptor(pDesc, nullptr);
rPattern.maSearchName = rAttr.GetFamilyName();
rPattern.SetWeight(rAttr.GetWeight());
rPattern.SetItalic(rAttr.GetItalic());
rPattern.SetPitch(rAttr.GetPitch());
rPattern.SetWidthType(rAttr.GetWidthType());
SalData* pSalData = GetSalData();
if (pSalData->mpFontList)
rPattern.mpFontData = pSalData->mpFontList->GetFontDataFromId(reinterpret_cast<sal_IntPtr>(pDesc));
CFRelease(pFallback);
}
CFRelease(pStr);
}
I'll take it a look but if you've got time, you can give it a try by adding this line in vcl/quartz/salgdi.cxx: CFRelease(pDesc); after this line: CFRelease(pFallback); Julien Nabet committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=986cd454b2a39ac380b137148f944c0d5ead2631 tdf#111497: fix leak in FindFontSubstitute with CFRelease It will be available in 6.0.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback. For 5.4, there's https://gerrit.libreoffice.org/#/c/40896/ waiting for review. Confirmed fixed in Version: 6.0.0.0.alpha0+ Build ID: 9f2a105aa1467224b662980f6d1c4a42e5d8bdfe CPU threads: 4; OS: Mac OS X 10.12.6; UI render: default; Locale: fr-FR (fr_FR.UTF-8); Calc: group Nice work Julien ! (In reply to Alex Thurgood from comment #6) > ... > Nice work Julien ! He! You and your analysis tool made 99% of the work! :-) If you find other things like this, don't hesitate to put me in cc. Julien Nabet committed a patch related to this issue. It has been pushed to "libreoffice-5-4": http://cgit.freedesktop.org/libreoffice/core/commit/?id=1756d2145e7ab70f5bb32a8343f5b1e4869bd0ee&h=libreoffice-5-4 tdf#111497: fix leak in FindFontSubstitute with CFRelease It will be available in 5.4.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback. |