[PATCH] gdi32: Don't enumerate font when OpenFontFace fails.

Qian Hong fracting at gmail.com
Thu Dec 6 07:20:00 CST 2012


On Thu, Dec 6, 2012 at 3:19 PM, Qian Hong <fracting at gmail.com> wrote:
> Hello,
> On Thu, Dec 6, 2012 at 3:42 PM, Dmitry Timoshkov <dmitry at baikal.ru> wrote:
>> 'face' and 'family' are leaked here. Also returning FALSE at this point
>> is too late since both 'face' and 'family' are already in the linked lists.
> Thanks for point out this! I'll investigate more.

The 'family' is not inserted to the font list here, get_enum_structs()
is called by get_fontdir(), which is called by
WineEngCreateScalableFontResource(). When we create a scalable font
resource, we don't add the font to the font list, we add the font to
the font list in WineEngAddFontResourceEx() instead, so there is no
need to worry about returning FALSE at this point. The only reason to
create a family and insert the face to the family here is because
get_enum_structs() need to copy string from face->family->FamilyName.

I've send an improved patch which fixed the memory leak issue, thanks
for your good eyes :)
Please let me know if I'm wrong with the above thinking, thanks!

Qian Hong

Sent from Ubuntu

More information about the wine-devel mailing list