[Libreoffice-bugs] [Bug 111497] CoreTextGlyphFallbackSubstitution::FindFontSubstitute() leaks memory on invocation

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Tue Aug 8 13:22:33 UTC 2017


https://bugs.documentfoundation.org/show_bug.cgi?id=111497

--- Comment #2 from Alex Thurgood <iplaw67 at tuta.io> ---
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);
    }

-- 
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/20170808/f617973c/attachment.html>


More information about the Libreoffice-bugs mailing list